Skip to content

Commit c2943fc

Browse files
authored
Fix destruction of core nodejs modules (#15643)
1 parent 76632c6 commit c2943fc

File tree

22 files changed

+281
-30
lines changed

22 files changed

+281
-30
lines changed

.github/workflows/test-nightly.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ jobs:
3232
- name: Get number of CPU cores
3333
id: cpu-cores
3434
uses: SimenB/github-actions-cpu-cores@97ba232459a8e02ff6121db9362b09661c875ab8 # v2.0.0
35+
- name: run node-env tests
36+
run: yarn test-node-env
3537
- name: run tests
3638
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
3739
with:

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ jobs:
3535
- name: Get number of CPU cores
3636
id: cpu-cores
3737
uses: SimenB/github-actions-cpu-cores@97ba232459a8e02ff6121db9362b09661c875ab8 # v2.0.0
38+
- name: run node-env tests
39+
run: yarn test-node-env
3840
- name: run tests
3941
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
4042
with:

e2e/console-debugging/jest.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,8 @@ require('./stdout-spy');
1010

1111
module.exports = {
1212
testEnvironment: 'node',
13+
testEnvironmentOptions: {
14+
globalsCleanupMode: 'hard',
15+
},
1316
verbose: true,
1417
};

e2e/esm-config/cjs/jest.config.cjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@
88
module.exports = {
99
displayName: 'Config from cjs file',
1010
testEnvironment: 'node',
11+
testEnvironmentOptions: {
12+
globalsCleanupMode: 'hard',
13+
},
1114
};

e2e/esm-config/js/jest.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ const displayName = await Promise.resolve('Config from js file');
1010
export default {
1111
displayName,
1212
testEnvironment: 'node',
13+
testEnvironmentOptions: {
14+
globalsCleanupMode: 'hard',
15+
},
1316
};

e2e/esm-config/mjs/jest.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ const displayName = await Promise.resolve('Config from mjs file');
1010
export default {
1111
displayName,
1212
testEnvironment: 'node',
13+
testEnvironmentOptions: {
14+
globalsCleanupMode: 'hard',
15+
},
1316
};

e2e/esm-config/ts/jest.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@
1010
type DummyConfig = {
1111
displayName: string;
1212
testEnvironment: string;
13+
testEnvironmentOptions?: {
14+
globalsCleanupMode: 'hard' | 'soft' | 'off';
15+
};
1316
};
1417

1518
const config: DummyConfig = {
1619
displayName: 'Config from ts file',
1720
testEnvironment: 'node',
21+
testEnvironmentOptions: {
22+
globalsCleanupMode: 'hard',
23+
},
1824
};
1925

2026
export default () => config;

e2e/typescript-config/modern-module-resolution/jest.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@
88
const config = {
99
displayName: 'Config from modern ts file',
1010
testEnvironment: 'node',
11+
testEnvironmentOptions: {
12+
globalsCleanupMode: 'hard',
13+
},
1114
};
1215
export default config;

examples/react-native/jest.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ const {resolve} = require('path');
22

33
module.exports = {
44
preset: 'react-native',
5+
testEnvironmentOptions: {
6+
globalsCleanupMode: 'soft',
7+
},
58
// this is specific to the Jest repo, not generally needed (the files we ignore will be in node_modules which is ignored by default)
69
transformIgnorePatterns: [resolve(__dirname, '../../packages')],
710
};

jest.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ export default {
3737
printBasicPrototype: true,
3838
},
3939
snapshotSerializers: [require.resolve('jest-serializer-ansi-escapes')],
40+
testEnvironmentOptions: {
41+
globalsCleanupMode: 'hard',
42+
},
4043
testPathIgnorePatterns: [
4144
'/__arbitraries__/',
4245
'/__benchmarks__/',

0 commit comments

Comments
 (0)