Skip to content

Commit 1e62f9a

Browse files
fix(jest): add watch commands
1 parent 5ea04d6 commit 1e62f9a

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/commands/test.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,31 @@ import { resolve } from 'path'
33
const jest = require('jest')
44

55
command(
6-
'test',
6+
'test [--watch] [--watchAll]',
77
'run unit-tests on your project',
88
args => {
99
return args
1010
},
1111
args => {
12-
test()
12+
const watch = args.watch || false
13+
const watchAll = args.watchAll || false
14+
test(watch, watchAll)
1315
}
1416
)
17+
.option('watch', {
18+
default: false,
19+
description: 're-run tests when files change'
20+
})
21+
.option('watchAll', {
22+
default: false,
23+
description: 're-run tests when files change regardless of git diff'
24+
})
1525

16-
function test() {
26+
function test(watch: boolean, watchAll: boolean) {
1727
jest.runCLI(
1828
{
29+
watch,
30+
watchAll,
1931
globals: JSON.stringify({
2032
__TRANSFORM_HTML__: true,
2133
'ts-jest': {

0 commit comments

Comments
 (0)