File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ function getEnv() {
4747 return envCopy
4848 } ,
4949 {
50- [ `SCRIPTS_${ script . toUpperCase ( ) } ` ] : true ,
50+ [ `SCRIPTS_${ script . toUpperCase ( ) . replace ( / - / g , '_' ) } ` ] : true ,
5151 } ,
5252 )
5353}
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ exports[`test does not watch --updateSnapshot 1`] = `--config {"builtInConfig":t
66
77exports [` test does not watch on CI 1` ] = ` --config { " builtInConfig" :true } ` ;
88
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 } ` ;
1010
1111exports [` test does not watch with --coverage 1` ] = ` --config { " builtInConfig" :true } --coverage` ;
1212
Original file line number Diff line number Diff line change 2424 const { run : jestRunMock } = require ( 'jest' )
2525 const originalArgv = process . argv
2626 const prevCI = mockIsCI
27- const prevPreCommit = process . env [ 'SCRIPTS_PRE-COMMIT' ]
27+ const prevPreCommit = process . env . SCRIPTS_PRE_COMMIT
2828 mockIsCI = ci
29- process . env [ 'SCRIPTS_PRE-COMMIT' ] = preCommit
29+ process . env . SCRIPTS_PRE_COMMIT = preCommit
3030 Object . assign ( utils , {
3131 hasPkgProp : ( ) => pkgHasJestProp ,
3232 hasFile : ( ) => hasJestConfigFile ,
5050 // afterEach
5151 process . argv = originalArgv
5252 mockIsCI = prevCI
53- process . env [ 'SCRIPTS_PRE-COMMIT' ] = prevPreCommit
53+ process . env . SCRIPTS_PRE_COMMIT = prevPreCommit
5454 jest . resetModules ( )
5555 }
5656 } ,
5959 'does not watch on CI' : {
6060 ci : true ,
6161 } ,
62- 'does not watch on SCRIPTS_PRE-COMMIT ' : {
62+ 'does not watch on SCRIPTS_PRE_COMMIT ' : {
6363 preCommit : 'true' ,
6464 } ,
6565 'does not watch with --no-watch' : {
Original file line number Diff line number Diff line change 1010 const { sync : crossSpawnSyncMock } = require ( 'cross-spawn' )
1111 const originalExit = process . exit
1212 process . exit = jest . fn ( )
13- process . env [ 'SCRIPTS_PRE-COMMIT' ] = 'false'
13+ process . env . SCRIPTS_PRE_COMMIT = 'false'
1414 const teardown = setup ( )
1515
1616 try {
@@ -50,10 +50,10 @@ cases(
5050 } ,
5151 [ `doesn't use test or lint if it's in pre-commit` ] : {
5252 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'
5555 return function teardown ( ) {
56- process . env [ 'SCRIPTS_PRE-COMMIT' ] = previousVal
56+ process . env . SCRIPTS_PRE_COMMIT = previousVal
5757 }
5858 } ) ,
5959 } ,
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ const args = process.argv.slice(2)
88
99const watch =
1010 ! isCI &&
11- ! parseEnv ( 'SCRIPTS_PRE-COMMIT ' , false ) &&
11+ ! parseEnv ( 'SCRIPTS_PRE_COMMIT ' , false ) &&
1212 ! args . includes ( '--no-watch' ) &&
1313 ! args . includes ( '--coverage' ) &&
1414 ! args . includes ( '--updateSnapshot' )
Original file line number Diff line number Diff line change 99// pre-commit runs linting and tests on the relevant files
1010// so those scripts don't need to be run if we're running
1111// 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 )
1313
1414const validateScripts = process . argv [ 2 ]
1515
You can’t perform that action at this time.
0 commit comments