Skip to content

Commit bf16f75

Browse files
committed
fix(devtools): correctly specify commands list
1 parent 5ad48fb commit bf16f75

File tree

2 files changed

+1
-26
lines changed

2 files changed

+1
-26
lines changed

packages/devtools/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
},
2222
"type": "module",
2323
"main": "./build/index.cjs",
24-
"module": "./build/index.js",
2524
"types": "./build/index.d.ts",
2625
"exports": {
2726
".": {

packages/devtools/src/devtoolsdriver.ts

+1-25
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
2-
import fs from 'node:fs'
3-
import url from 'node:url'
4-
import path from 'node:path'
52
import type { EventEmitter } from 'node:events'
63

74
import { v4 as uuidv4 } from 'uuid'
@@ -21,7 +18,6 @@ import { validate, sanitizeError } from './utils.js'
2118
import { DEFAULT_IMPLICIT_TIMEOUT, DEFAULT_PAGELOAD_TIMEOUT, DEFAULT_SCRIPT_TIMEOUT } from './constants.js'
2219
import type { ActiveListener } from './types.js'
2320

24-
const __dirname = path.dirname(url.fileURLToPath(import.meta.url))
2521
const log = logger('devtools')
2622

2723
export default class DevToolsDriver {
@@ -38,27 +34,7 @@ export default class DevToolsDriver {
3834
activeListeners: ActiveListener[] = []
3935
constructor(browser: Browser, pages: Page[]) {
4036
this.browser = browser
41-
42-
const dir = path.resolve(__dirname, 'commands')
43-
const files = fs.readdirSync(dir).filter(
44-
(file) => (
45-
file.endsWith('.js') ||
46-
(
47-
file.endsWith('.ts') &&
48-
!file.endsWith('.d.ts')
49-
)
50-
)
51-
)
52-
53-
for (const filename of files) {
54-
const commandName = path.basename(filename, path.extname(filename))
55-
56-
if (!commandName) {
57-
throw new Error('Couldn\'t determine command name')
58-
}
59-
60-
this.commands[commandName] = commands[commandName as keyof typeof commands]
61-
}
37+
this.commands = commands
6238

6339
this.initBrowser(browser, pages)
6440
}

0 commit comments

Comments
 (0)