-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Map code coverage from transformers (#2290)
* source map support for coverage * be less dangerous only enforce files in src/ having @flow since everything else may not be run through babel * lazy require for istanbul-lib-source-maps * add documentation for mapCoverage config option * store source maps on disk instead of in worker process memory * add mapCoverage to CLI, switch off by default * move source map info from coverage object to jest-runtime * tweak docs, fix a test
- Loading branch information
1 parent
d85989d
commit c6d2b08
Showing
28 changed files
with
770 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
348 changes: 348 additions & 0 deletions
348
integration_tests/__tests__/__snapshots__/coverage-remapping-test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,348 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`maps code coverage against original source 1`] = ` | ||
Object { | ||
"covered.ts": Object { | ||
"b": Object { | ||
"0": Array [ | ||
1, | ||
0, | ||
], | ||
"1": Array [ | ||
1, | ||
0, | ||
], | ||
"2": Array [ | ||
1, | ||
0, | ||
0, | ||
], | ||
"3": Array [ | ||
1, | ||
0, | ||
], | ||
}, | ||
"branchMap": Object { | ||
"0": Object { | ||
"loc": Object { | ||
"end": Object { | ||
"column": 9, | ||
"line": 5, | ||
}, | ||
"start": Object { | ||
"column": 8, | ||
"line": 5, | ||
}, | ||
}, | ||
"locations": Array [ | ||
Object { | ||
"end": Object { | ||
"column": 9, | ||
"line": 5, | ||
}, | ||
"start": Object { | ||
"column": 8, | ||
"line": 5, | ||
}, | ||
}, | ||
Object { | ||
"end": Object { | ||
"column": 9, | ||
"line": 6, | ||
}, | ||
"start": Object { | ||
"column": 8, | ||
"line": 6, | ||
}, | ||
}, | ||
], | ||
"type": "cond-expr", | ||
}, | ||
"1": Object { | ||
"loc": Object { | ||
"end": Object { | ||
"column": 37, | ||
"line": 7, | ||
}, | ||
"start": Object { | ||
"column": 36, | ||
"line": 7, | ||
}, | ||
}, | ||
"locations": Array [ | ||
Object { | ||
"end": Object { | ||
"column": 37, | ||
"line": 7, | ||
}, | ||
"start": Object { | ||
"column": 36, | ||
"line": 7, | ||
}, | ||
}, | ||
Object { | ||
"end": Object { | ||
"column": 41, | ||
"line": 7, | ||
}, | ||
"start": Object { | ||
"column": 40, | ||
"line": 7, | ||
}, | ||
}, | ||
], | ||
"type": "cond-expr", | ||
}, | ||
"2": Object { | ||
"loc": Object { | ||
"end": Object { | ||
"column": 33, | ||
"line": 8, | ||
}, | ||
"start": Object { | ||
"column": 29, | ||
"line": 8, | ||
}, | ||
}, | ||
"locations": Array [ | ||
Object { | ||
"end": Object { | ||
"column": 33, | ||
"line": 8, | ||
}, | ||
"start": Object { | ||
"column": 29, | ||
"line": 8, | ||
}, | ||
}, | ||
Object { | ||
"end": Object { | ||
"column": 41, | ||
"line": 8, | ||
}, | ||
"start": Object { | ||
"column": 37, | ||
"line": 8, | ||
}, | ||
}, | ||
Object { | ||
"end": Object { | ||
"column": 50, | ||
"line": 8, | ||
}, | ||
"start": Object { | ||
"column": 45, | ||
"line": 8, | ||
}, | ||
}, | ||
], | ||
"type": "binary-expr", | ||
}, | ||
"3": Object { | ||
"loc": Object { | ||
"end": Object { | ||
"column": 42, | ||
"line": 9, | ||
}, | ||
"start": Object { | ||
"column": 32, | ||
"line": 9, | ||
}, | ||
}, | ||
"locations": Array [ | ||
Object { | ||
"end": Object { | ||
"column": 42, | ||
"line": 9, | ||
}, | ||
"start": Object { | ||
"column": 32, | ||
"line": 9, | ||
}, | ||
}, | ||
Object { | ||
"end": Object { | ||
"column": 55, | ||
"line": 9, | ||
}, | ||
"start": Object { | ||
"column": 45, | ||
"line": 9, | ||
}, | ||
}, | ||
], | ||
"type": "cond-expr", | ||
}, | ||
}, | ||
"f": Object { | ||
"0": 1, | ||
"1": 0, | ||
"2": 0, | ||
}, | ||
"fnMap": Object { | ||
"0": Object { | ||
"decl": Object { | ||
"end": Object { | ||
"column": 28, | ||
"line": 3, | ||
}, | ||
"start": Object { | ||
"column": 9, | ||
"line": 3, | ||
}, | ||
}, | ||
"loc": Object { | ||
"end": Object { | ||
"column": 1, | ||
"line": 12, | ||
}, | ||
"start": Object { | ||
"column": 49, | ||
"line": 3, | ||
}, | ||
}, | ||
"name": "difference", | ||
}, | ||
"1": Object { | ||
"decl": Object { | ||
"end": Object { | ||
"column": 37, | ||
"line": 9, | ||
}, | ||
"start": Object { | ||
"column": 32, | ||
"line": 9, | ||
}, | ||
}, | ||
"loc": Object { | ||
"end": Object { | ||
"column": 42, | ||
"line": 9, | ||
}, | ||
"start": Object { | ||
"column": 32, | ||
"line": 9, | ||
}, | ||
}, | ||
"name": "(anonymous_1)", | ||
}, | ||
"2": Object { | ||
"decl": Object { | ||
"end": Object { | ||
"column": 50, | ||
"line": 9, | ||
}, | ||
"start": Object { | ||
"column": 45, | ||
"line": 9, | ||
}, | ||
}, | ||
"loc": Object { | ||
"end": Object { | ||
"column": 55, | ||
"line": 9, | ||
}, | ||
"start": Object { | ||
"column": 45, | ||
"line": 9, | ||
}, | ||
}, | ||
"name": "(anonymous_2)", | ||
}, | ||
}, | ||
"path": "covered.ts", | ||
"s": Object { | ||
"0": 1, | ||
"1": 1, | ||
"2": 1, | ||
"3": 1, | ||
"4": 1, | ||
"5": 0, | ||
"6": 0, | ||
"7": 1, | ||
}, | ||
"statementMap": Object { | ||
"0": Object { | ||
"end": Object { | ||
"column": 1, | ||
"line": 12, | ||
}, | ||
"start": Object { | ||
"column": 0, | ||
"line": 3, | ||
}, | ||
}, | ||
"1": Object { | ||
"end": Object { | ||
"column": 9, | ||
"line": 6, | ||
}, | ||
"start": Object { | ||
"column": 29, | ||
"line": 4, | ||
}, | ||
}, | ||
"2": Object { | ||
"end": Object { | ||
"column": 41, | ||
"line": 7, | ||
}, | ||
"start": Object { | ||
"column": 29, | ||
"line": 7, | ||
}, | ||
}, | ||
"3": Object { | ||
"end": Object { | ||
"column": 50, | ||
"line": 8, | ||
}, | ||
"start": Object { | ||
"column": 29, | ||
"line": 8, | ||
}, | ||
}, | ||
"4": Object { | ||
"end": Object { | ||
"column": 55, | ||
"line": 9, | ||
}, | ||
"start": Object { | ||
"column": 25, | ||
"line": 9, | ||
}, | ||
}, | ||
"5": Object { | ||
"end": Object { | ||
"column": 42, | ||
"line": 9, | ||
}, | ||
"start": Object { | ||
"column": 38, | ||
"line": 9, | ||
}, | ||
}, | ||
"6": Object { | ||
"end": Object { | ||
"column": 55, | ||
"line": 9, | ||
}, | ||
"start": Object { | ||
"column": 51, | ||
"line": 9, | ||
}, | ||
}, | ||
"7": Object { | ||
"end": Object { | ||
"column": 17, | ||
"line": 11, | ||
}, | ||
"start": Object { | ||
"column": 4, | ||
"line": 11, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
`; |
Oops, something went wrong.