Skip to content

Revert changes for source map suppport (#5945) #6106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 2, 2018
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: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@
([#5888](https://github.com/facebook/jest/pull/5888))
* `[jest-mock]` [**BREAKING**] Replace timestamps with `invocationCallOrder`
([#5867](https://github.com/facebook/jest/pull/5867))
* `[jest-jasmine2]` Install `sourcemap-support` into normal runtime to catch
runtime errors ([#5945](https://github.com/facebook/jest/pull/5945))
* `[jest-jasmine2]` Added assertion error handling inside `afterAll hook`
([#5884](https://github.com/facebook/jest/pull/5884))
* `[jest-cli]` Remove the notifier actions in case of failure when not in watch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ exports[`cannot test with no implementation 1`] = `
1 |
2 | it('it', () => {});
> 3 | it('it, no implementation');
| ^
| ^
4 | test('test, no implementation');
5 |

Expand Down Expand Up @@ -57,7 +57,7 @@ exports[`cannot test with no implementation with expand arg 1`] = `
1 |
2 | it('it', () => {});
> 3 | it('it, no implementation');
| ^
| ^
4 | test('test, no implementation');
5 |

Expand Down
1 change: 0 additions & 1 deletion integration-tests/__tests__/stack_trace.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ describe('Stack Trace', () => {
expect(stderr).toMatch(
/ReferenceError: thisIsARuntimeError is not defined/,
);
expect(stderr).toMatch(/> 10 \| thisIsARuntimeError\(\);/);
expect(stderr).toMatch(
/\s+at\s(?:.+?)\s\(__tests__\/runtime_error.test\.js/,
);
Expand Down
43 changes: 18 additions & 25 deletions packages/jest-jasmine2/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import type Runtime from 'jest-runtime';
import path from 'path';
import fs from 'graceful-fs';
import {getCallsite} from 'jest-util';
import sourcemapSupport from 'source-map-support';
import JasmineReporter from './reporter';
import {install as jasmineAsyncInstall} from './jasmine_async';

Expand Down Expand Up @@ -117,35 +116,29 @@ async function jasmine2(
runtime.requireModule(config.setupTestFrameworkScriptFile);
}

const sourcemapOptions = {
environment: 'node',
handleUncaughtExceptions: false,
retrieveSourceMap: source => {
const sourceMaps = runtime.getSourceMaps();
const sourceMapSource = sourceMaps && sourceMaps[source];

if (sourceMapSource) {
try {
return {
map: JSON.parse(fs.readFileSync(sourceMapSource)),
url: source,
};
} catch (e) {}
}
return null;
},
};

// For tests
runtime
.requireInternalModule(
require.resolve('source-map-support'),
'source-map-support',
)
.install(sourcemapOptions);

// For runtime errors
sourcemapSupport.install(sourcemapOptions);
.install({
environment: 'node',
handleUncaughtExceptions: false,
retrieveSourceMap: source => {
const sourceMaps = runtime.getSourceMaps();
const sourceMapSource = sourceMaps && sourceMaps[source];

if (sourceMapSource) {
try {
return {
map: JSON.parse(fs.readFileSync(sourceMapSource)),
url: source,
};
} catch (e) {}
}
return null;
},
});

if (globalConfig.enabledTestsMap) {
env.specFilter = spec => {
Expand Down