Skip to content

Commit

Permalink
feat: --watch mode
Browse files Browse the repository at this point in the history
Closes: #5
  • Loading branch information
ChALkeR committed Jul 10, 2024
1 parent c2c72ee commit 0ad1ad7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 10 additions & 1 deletion bin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -63,6 +64,9 @@ function parseOptions() {
case '--coverage':
options.coverage = true
break
case '--watch':
options.watch = true
break
case '--passWithNoTests':
options.passWithNoTests = true
break
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 0ad1ad7

Please sign in to comment.