Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/run-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function getEnv() {
return envCopy
},
{
[`SCRIPTS_${script.toUpperCase()}`]: true,
[`SCRIPTS_${script.toUpperCase().replace(/-/g, '_')}`]: true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If previous SCRIPTS_ environment variables were considered as public API it wouldn't harm to also include them here - in addition to the new ones.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like it never really worked in the first place so I don't think they could have been considered public either way 🙃

},
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/__tests__/__snapshots__/test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports[`test does not watch --updateSnapshot 1`] = `--config {"builtInConfig":t

exports[`test does not watch on CI 1`] = `--config {"builtInConfig":true}`;

exports[`test does not watch on SCRIPTS_PRE-COMMIT 1`] = `--config {"builtInConfig":true}`;
exports[`test does not watch on SCRIPTS_PRE_COMMIT 1`] = `--config {"builtInConfig":true}`;

exports[`test does not watch with --coverage 1`] = `--config {"builtInConfig":true} --coverage`;

Expand Down
8 changes: 4 additions & 4 deletions src/scripts/__tests__/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ cases(
const {run: jestRunMock} = require('jest')
const originalArgv = process.argv
const prevCI = mockIsCI
const prevPreCommit = process.env['SCRIPTS_PRE-COMMIT']
const prevPreCommit = process.env.SCRIPTS_PRE_COMMIT
mockIsCI = ci
process.env['SCRIPTS_PRE-COMMIT'] = preCommit
process.env.SCRIPTS_PRE_COMMIT = preCommit
Object.assign(utils, {
hasPkgProp: () => pkgHasJestProp,
hasFile: () => hasJestConfigFile,
Expand All @@ -50,7 +50,7 @@ cases(
// afterEach
process.argv = originalArgv
mockIsCI = prevCI
process.env['SCRIPTS_PRE-COMMIT'] = prevPreCommit
process.env.SCRIPTS_PRE_COMMIT = prevPreCommit
jest.resetModules()
}
},
Expand All @@ -59,7 +59,7 @@ cases(
'does not watch on CI': {
ci: true,
},
'does not watch on SCRIPTS_PRE-COMMIT': {
'does not watch on SCRIPTS_PRE_COMMIT': {
preCommit: 'true',
},
'does not watch with --no-watch': {
Expand Down
8 changes: 4 additions & 4 deletions src/scripts/__tests__/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cases(
const {sync: crossSpawnSyncMock} = require('cross-spawn')
const originalExit = process.exit
process.exit = jest.fn()
process.env['SCRIPTS_PRE-COMMIT'] = 'false'
process.env.SCRIPTS_PRE_COMMIT = 'false'
const teardown = setup()

try {
Expand Down Expand Up @@ -50,10 +50,10 @@ cases(
},
[`doesn't use test or lint if it's in pre-commit`]: {
setup: withDefaultSetup(() => {
const previousVal = process.env['SCRIPTS_PRE-COMMIT']
process.env['SCRIPTS_PRE-COMMIT'] = 'true'
const previousVal = process.env.SCRIPTS_PRE_COMMIT
process.env.SCRIPTS_PRE_COMMIT = 'true'
return function teardown() {
process.env['SCRIPTS_PRE-COMMIT'] = previousVal
process.env.SCRIPTS_PRE_COMMIT = previousVal
}
}),
},
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const args = process.argv.slice(2)

const watch =
!isCI &&
!parseEnv('SCRIPTS_PRE-COMMIT', false) &&
!parseEnv('SCRIPTS_PRE_COMMIT', false) &&
!args.includes('--no-watch') &&
!args.includes('--coverage') &&
!args.includes('--updateSnapshot')
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const {
// pre-commit runs linting and tests on the relevant files
// so those scripts don't need to be run if we're running
// this in the context of a pre-commit hook.
const preCommit = parseEnv('SCRIPTS_PRE-COMMIT', false)
const preCommit = parseEnv('SCRIPTS_PRE_COMMIT', false)

const validateScripts = process.argv[2]

Expand Down