Skip to content

Commit d6eaa5f

Browse files
committed
Add bundle-stdin option
1 parent cc86645 commit d6eaa5f

File tree

3 files changed

+359
-298
lines changed

3 files changed

+359
-298
lines changed

index.js

+18-5
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ const opts = yargs(hideBin(process.argv))
3636
group: 'Options:',
3737
describe: 'Bundle the resolved spec using the given command'
3838
})
39+
.option('bundle-stdin', {
40+
type: 'string',
41+
group: 'Options:',
42+
describe:
43+
'Pass a synthetic file as stdin to the bundler with "require" or "import" statements for each spec file'
44+
})
3945
.option('esm', {
4046
type: 'boolean',
4147
group: 'Options:',
@@ -57,23 +63,27 @@ const opts = yargs(hideBin(process.argv))
5763
'Options:': 'Other:'
5864
})
5965
.example(
60-
'$0 --driver puppeteer --bundle browserify "./src/**/*.test.js" ',
66+
'$0 --driver puppeteer --bundle browserify "./src/**/*.test.js"',
6167
'Bundle all files matching the given spec using browserify and run them using @mochify/driver-puppeteer.'
6268
)
6369
.example(
64-
'$0 --esm --reporter dot --driver puppeteer "./src/**/*.test.js" ',
70+
'$0 --driver playwright --bundle esbuild --bundle-stdin "require" "./src/**/*.test.js"',
71+
'Bundle all files matching the given spec using esbuild and run them using @mochify/driver-playwright.'
72+
)
73+
.example(
74+
'$0 --esm --reporter dot --driver puppeteer "./src/**/*.test.js"',
6575
'Run all tests matching the given spec as ES modules in puppeteer and use the "dot" reporter for output.'
6676
)
6777
.example(
68-
'$0 "./src/**/*.test.js" ',
78+
'$0 "./src/**/*.test.js"',
6979
'Run all tests matching the given spec using the default configuration lookup.'
7080
)
7181
.example(
72-
'$0 --config mochify.webdriver.js "./src/**/*.test.js" ',
82+
'$0 --config mochify.webdriver.js "./src/**/*.test.js"',
7383
'Run all tests matching the given spec using the configuration from mochify.webdriver.js.'
7484
)
7585
.example(
76-
'browserify "./src/**/*.test.js" | $0 -',
86+
'browserify "./src/**/*.test.js" | $0 -',
7787
'Read a bundled test suite from stdin.'
7888
)
7989
.epilogue(
@@ -89,6 +99,9 @@ if (opts['driver-option']) {
8999
if (opts['server-option']) {
90100
opts.server_options = opts['server-option'];
91101
}
102+
if (opts['bundle-stdin']) {
103+
opts.bundle_stdin = opts['bundle-stdin'];
104+
}
92105

93106
if (opts._.length) {
94107
if (opts._[0] === '-') {

0 commit comments

Comments
 (0)