Skip to content
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

Improve source map handling when instrumenting transformed code (#5739) #9811

Merged
merged 15 commits into from Apr 23, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,8 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`processes stack traces and code frames with source maps with coverage 1`] = `
Object {
"rest": "FAIL __tests__/fails.ts
FAIL __tests__/fails.ts
✕ fails

● fails
Expand All @@ -17,11 +16,5 @@ Object {
15 |

at Object.error (lib.ts:13:9)
at Object.<anonymous> (__tests__/fails.ts:10:3)",
"summary": "Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: <<REPLACED>>
Ran all test suites.",
}
at Object.<anonymous> (__tests__/fails.ts:10:3)
`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For posterity (if we ever come back to this and wonder why we pass sourcemap into Babel), this is the error if running this test without the other changes in this PR

image

3 changes: 2 additions & 1 deletion e2e/__tests__/stackTraceSourceMapsWithCoverage.test.ts
Expand Up @@ -7,6 +7,7 @@
import * as path from 'path';
import {extractSummary, run} from '../Utils';
import runJest from '../runJest';
import wrap from 'jest-snapshot-serializer-raw';
SimenB marked this conversation as resolved.
Show resolved Hide resolved

it('processes stack traces and code frames with source maps with coverage', () => {
const dir = path.resolve(
Expand All @@ -17,5 +18,5 @@ it('processes stack traces and code frames with source maps with coverage', () =
const {stderr} = runJest(dir, ['--no-cache', '--coverage']);

// Should report an error at source line 13 in lib.ts at line 10 of the test
SimenB marked this conversation as resolved.
Show resolved Hide resolved
expect(extractSummary(stderr)).toMatchSnapshot();
expect(wrap(extractSummary(stderr).rest)).toMatchSnapshot();
});