Skip to content

Commit 45cd277

Browse files
authored
Revert jestjs#5945, as it introduces a memory leak (jestjs#6106)
1 parent fa46cdb commit 45cd277

File tree

4 files changed

+20
-30
lines changed

4 files changed

+20
-30
lines changed

CHANGELOG.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@
9393
([#5888](https://github.com/facebook/jest/pull/5888))
9494
* `[jest-mock]` [**BREAKING**] Replace timestamps with `invocationCallOrder`
9595
([#5867](https://github.com/facebook/jest/pull/5867))
96-
* `[jest-jasmine2]` Install `sourcemap-support` into normal runtime to catch
97-
runtime errors ([#5945](https://github.com/facebook/jest/pull/5945))
9896
* `[jest-jasmine2]` Added assertion error handling inside `afterAll hook`
9997
([#5884](https://github.com/facebook/jest/pull/5884))
10098
* `[jest-cli]` Remove the notifier actions in case of failure when not in watch

integration-tests/__tests__/__snapshots__/globals.test.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ exports[`cannot test with no implementation 1`] = `
2929
1 |
3030
2 | it('it', () => {});
3131
> 3 | it('it, no implementation');
32-
| ^
32+
| ^
3333
4 | test('test, no implementation');
3434
5 |
3535
@@ -57,7 +57,7 @@ exports[`cannot test with no implementation with expand arg 1`] = `
5757
1 |
5858
2 | it('it', () => {});
5959
> 3 | it('it, no implementation');
60-
| ^
60+
| ^
6161
4 | test('test, no implementation');
6262
5 |
6363

integration-tests/__tests__/stack_trace.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ describe('Stack Trace', () => {
2222
expect(stderr).toMatch(
2323
/ReferenceError: thisIsARuntimeError is not defined/,
2424
);
25-
expect(stderr).toMatch(/> 10 \| thisIsARuntimeError\(\);/);
2625
expect(stderr).toMatch(
2726
/\s+at\s(?:.+?)\s\(__tests__\/runtime_error.test\.js/,
2827
);

packages/jest-jasmine2/src/index.js

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import type Runtime from 'jest-runtime';
1717
import path from 'path';
1818
import fs from 'graceful-fs';
1919
import {getCallsite} from 'jest-util';
20-
import sourcemapSupport from 'source-map-support';
2120
import JasmineReporter from './reporter';
2221
import {install as jasmineAsyncInstall} from './jasmine_async';
2322

@@ -117,35 +116,29 @@ async function jasmine2(
117116
runtime.requireModule(config.setupTestFrameworkScriptFile);
118117
}
119118

120-
const sourcemapOptions = {
121-
environment: 'node',
122-
handleUncaughtExceptions: false,
123-
retrieveSourceMap: source => {
124-
const sourceMaps = runtime.getSourceMaps();
125-
const sourceMapSource = sourceMaps && sourceMaps[source];
126-
127-
if (sourceMapSource) {
128-
try {
129-
return {
130-
map: JSON.parse(fs.readFileSync(sourceMapSource)),
131-
url: source,
132-
};
133-
} catch (e) {}
134-
}
135-
return null;
136-
},
137-
};
138-
139-
// For tests
140119
runtime
141120
.requireInternalModule(
142121
require.resolve('source-map-support'),
143122
'source-map-support',
144123
)
145-
.install(sourcemapOptions);
146-
147-
// For runtime errors
148-
sourcemapSupport.install(sourcemapOptions);
124+
.install({
125+
environment: 'node',
126+
handleUncaughtExceptions: false,
127+
retrieveSourceMap: source => {
128+
const sourceMaps = runtime.getSourceMaps();
129+
const sourceMapSource = sourceMaps && sourceMaps[source];
130+
131+
if (sourceMapSource) {
132+
try {
133+
return {
134+
map: JSON.parse(fs.readFileSync(sourceMapSource)),
135+
url: source,
136+
};
137+
} catch (e) {}
138+
}
139+
return null;
140+
},
141+
});
149142

150143
if (globalConfig.enabledTestsMap) {
151144
env.specFilter = spec => {

0 commit comments

Comments
 (0)