Skip to content

Commit 6affd57

Browse files
dennisamelingdscho
authored andcommitted
jest: do not let the user's PATH bleed into the tests
Signed-off-by: Dennis Ameling <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 68902d3 commit 6affd57

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.jest/set-env-vars.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/*
2+
This ensures that the PATH of the machine that the tests are running on,
3+
doesn't leak into our tests.
4+
*/
5+
process.env.PATH = ''

jest.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
module.exports = {
22
clearMocks: true,
33
moduleFileExtensions: ['js', 'ts'],
4+
setupFiles: ["<rootDir>/.jest/set-env-vars.js"],
45
testEnvironment: 'node',
56
testMatch: ['**/*.test.ts'],
67
testRunner: 'jest-circus/runner',
78
transform: {
89
'^.+\\.ts$': 'ts-jest'
910
},
1011
verbose: true
11-
}
12+
}

0 commit comments

Comments
 (0)