-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement support for watch mode (#32)
Fixes #28. This patch adds a dependency on `yargs` to be able to parse command-line arguments. If `--watch` is provided, it will be passed along to the spawned Node.js child process. As a side effect of using yargs, we now also support the commands `ts-node-test --version` and `ts-node-test --help`.
- Loading branch information
Showing
6 changed files
with
186 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,21 @@ | ||
#!/usr/bin/env node | ||
|
||
import { main } from './index.js' | ||
import yargs from 'yargs' | ||
|
||
await main() | ||
const parsedArgs = yargs(process.argv.slice(2)).command('* <paths...>', 'Run tests', (yargs) => { | ||
return yargs.options({ | ||
watch: { | ||
type: 'boolean', | ||
default: false, | ||
description: 'Run in watch mode' | ||
} | ||
}).positional('paths', { | ||
type: 'string', | ||
array: true, | ||
demandOption: true, | ||
description: 'Paths to test files' | ||
}) | ||
}).parseSync() | ||
|
||
await main(parsedArgs.paths, parsedArgs) |
Oops, something went wrong.