diff --git a/README.md b/README.md index 2697119..a70aa2e 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ Just use `"test": "exodus-test"` - `--coverage-engine node` -- use Node.js builtint coverage engine +- `--watch` -- operate in watch mode and re-run tests on file changes + - `--passWithNoTests` -- do not error when no test files were found - `--write-snapshots` -- write snapshots instead of verifying them (has `--test-update-snapshots` alias) diff --git a/bin/index.js b/bin/index.js index 6ccb7fd..526d7bb 100755 --- a/bin/index.js +++ b/bin/index.js @@ -26,9 +26,10 @@ function parseOptions() { esbuild: false, babel: false, coverage: false, + coverageEngine: 'c8', // c8 or node + watch: false, passWithNoTests: false, writeSnapshots: false, - coverageEngine: 'c8', // c8 or node } const args = [...process.argv] @@ -63,6 +64,9 @@ function parseOptions() { case '--coverage': options.coverage = true break + case '--watch': + options.watch = true + break case '--passWithNoTests': options.passWithNoTests = true break @@ -120,6 +124,11 @@ if (options.forceExit) { args.push('--test-force-exit') } +if (options.watch) { + assert((major === 18 && minor > 13) || major >= 20, 'For watch mode, use Node.js >= 18.13.0') + args.push('--watch') +} + if (options.coverage) { if (options.coverageEngine === 'node') { args.push('--experimental-test-coverage')