File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed
packages/jest-circus/src/legacy-code-todo-rewrite Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 58
58
- run : *install
59
59
- save-cache : *save-cache
60
60
- run :
61
- command : JEST_CIRCUS=1 yarn test-ci-partial
61
+ command : JEST_CIRCUS=1 yarn test-ci-partial && JEST_CIRCUS=1 yarn test-leak
62
62
- store_test_results :
63
63
path : reports/junit
64
64
Original file line number Diff line number Diff line change 8
8
9
9
### Performance
10
10
11
+ - ` [jest-circus] ` Fix memory leak when running in band ([ #9934 ] ( https://github.com/facebook/jest/pull/9934 ) )
12
+
11
13
## 25.5.2
12
14
13
15
### Fixes
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import type {JestEnvironment} from '@jest/environment';
11
11
import type { TestResult } from '@jest/test-result' ;
12
12
import type { RuntimeType as Runtime } from 'jest-runtime' ;
13
13
import type { SnapshotStateType } from 'jest-snapshot' ;
14
+ import { deepCyclicCopy } from 'jest-util' ;
14
15
15
16
const FRAMEWORK_INITIALIZER = path . resolve ( __dirname , './jestAdapterInit.js' ) ;
16
17
const EXPECT_INITIALIZER = path . resolve ( __dirname , './jestExpect.js' ) ;
@@ -101,7 +102,13 @@ const jestAdapter = async (
101
102
globalConfig,
102
103
testPath,
103
104
} ) ;
104
- return _addSnapshotData ( results , snapshotState ) ;
105
+
106
+ _addSnapshotData ( results , snapshotState ) ;
107
+
108
+ // We need to copy the results object to ensure we don't leaks the prototypes
109
+ // from the VM. Jasmine creates the result objects in the parent process, we
110
+ // should consider doing that for circus as well.
111
+ return deepCyclicCopy ( results , { keepPrototype : false } ) ;
105
112
} ;
106
113
107
114
const _addSnapshotData = (
@@ -131,7 +138,6 @@ const _addSnapshotData = (
131
138
results . snapshot . unchecked = ! status . deleted ? uncheckedCount : 0 ;
132
139
// Copy the array to prevent memory leaks
133
140
results . snapshot . uncheckedKeys = Array . from ( uncheckedKeys ) ;
134
- return results ;
135
141
} ;
136
142
137
143
export = jestAdapter ;
You can’t perform that action at this time.
0 commit comments