File tree 6 files changed +12
-12
lines changed
6 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ function getEnv() {
47
47
return envCopy
48
48
} ,
49
49
{
50
- [ `SCRIPTS_${ script . toUpperCase ( ) } ` ] : true ,
50
+ [ `SCRIPTS_${ script . toUpperCase ( ) . replace ( / - / g , '_' ) } ` ] : true ,
51
51
} ,
52
52
)
53
53
}
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ exports[`test does not watch --updateSnapshot 1`] = `--config {"builtInConfig":t
6
6
7
7
exports [` test does not watch on CI 1` ] = ` --config { " builtInConfig" :true } ` ;
8
8
9
- exports [` test does not watch on SCRIPTS_PRE-COMMIT 1` ] = ` --config { " builtInConfig" :true } ` ;
9
+ exports [` test does not watch on SCRIPTS_PRE_COMMIT 1` ] = ` --config { " builtInConfig" :true } ` ;
10
10
11
11
exports [` test does not watch with --coverage 1` ] = ` --config { " builtInConfig" :true } --coverage` ;
12
12
Original file line number Diff line number Diff line change 24
24
const { run : jestRunMock } = require ( 'jest' )
25
25
const originalArgv = process . argv
26
26
const prevCI = mockIsCI
27
- const prevPreCommit = process . env [ 'SCRIPTS_PRE-COMMIT' ]
27
+ const prevPreCommit = process . env . SCRIPTS_PRE_COMMIT
28
28
mockIsCI = ci
29
- process . env [ 'SCRIPTS_PRE-COMMIT' ] = preCommit
29
+ process . env . SCRIPTS_PRE_COMMIT = preCommit
30
30
Object . assign ( utils , {
31
31
hasPkgProp : ( ) => pkgHasJestProp ,
32
32
hasFile : ( ) => hasJestConfigFile ,
50
50
// afterEach
51
51
process . argv = originalArgv
52
52
mockIsCI = prevCI
53
- process . env [ 'SCRIPTS_PRE-COMMIT' ] = prevPreCommit
53
+ process . env . SCRIPTS_PRE_COMMIT = prevPreCommit
54
54
jest . resetModules ( )
55
55
}
56
56
} ,
59
59
'does not watch on CI' : {
60
60
ci : true ,
61
61
} ,
62
- 'does not watch on SCRIPTS_PRE-COMMIT ' : {
62
+ 'does not watch on SCRIPTS_PRE_COMMIT ' : {
63
63
preCommit : 'true' ,
64
64
} ,
65
65
'does not watch with --no-watch' : {
Original file line number Diff line number Diff line change 10
10
const { sync : crossSpawnSyncMock } = require ( 'cross-spawn' )
11
11
const originalExit = process . exit
12
12
process . exit = jest . fn ( )
13
- process . env [ 'SCRIPTS_PRE-COMMIT' ] = 'false'
13
+ process . env . SCRIPTS_PRE_COMMIT = 'false'
14
14
const teardown = setup ( )
15
15
16
16
try {
@@ -50,10 +50,10 @@ cases(
50
50
} ,
51
51
[ `doesn't use test or lint if it's in pre-commit` ] : {
52
52
setup : withDefaultSetup ( ( ) => {
53
- const previousVal = process . env [ 'SCRIPTS_PRE-COMMIT' ]
54
- process . env [ 'SCRIPTS_PRE-COMMIT' ] = 'true'
53
+ const previousVal = process . env . SCRIPTS_PRE_COMMIT
54
+ process . env . SCRIPTS_PRE_COMMIT = 'true'
55
55
return function teardown ( ) {
56
- process . env [ 'SCRIPTS_PRE-COMMIT' ] = previousVal
56
+ process . env . SCRIPTS_PRE_COMMIT = previousVal
57
57
}
58
58
} ) ,
59
59
} ,
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ const args = process.argv.slice(2)
8
8
9
9
const watch =
10
10
! isCI &&
11
- ! parseEnv ( 'SCRIPTS_PRE-COMMIT ' , false ) &&
11
+ ! parseEnv ( 'SCRIPTS_PRE_COMMIT ' , false ) &&
12
12
! args . includes ( '--no-watch' ) &&
13
13
! args . includes ( '--coverage' ) &&
14
14
! args . includes ( '--updateSnapshot' )
Original file line number Diff line number Diff line change 9
9
// pre-commit runs linting and tests on the relevant files
10
10
// so those scripts don't need to be run if we're running
11
11
// this in the context of a pre-commit hook.
12
- const preCommit = parseEnv ( 'SCRIPTS_PRE-COMMIT ' , false )
12
+ const preCommit = parseEnv ( 'SCRIPTS_PRE_COMMIT ' , false )
13
13
14
14
const validateScripts = process . argv [ 2 ]
15
15
You can’t perform that action at this time.
0 commit comments