Skip to content

Commit 2b37b64

Browse files
committed
coverage?
1 parent 2bca3b6 commit 2b37b64

File tree

8 files changed

+29
-44
lines changed

8 files changed

+29
-44
lines changed

e2e/__tests__/__snapshots__/coverage_remapping.test.js.snap

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ Object {
183183
"0": Object {
184184
"decl": Object {
185185
"end": Object {
186-
"column": 28,
186+
"column": 29,
187187
"line": 3,
188188
},
189189
"start": Object {
@@ -206,7 +206,7 @@ Object {
206206
"1": Object {
207207
"decl": Object {
208208
"end": Object {
209-
"column": 35,
209+
"column": 36,
210210
"line": 7,
211211
},
212212
"start": Object {
@@ -229,7 +229,7 @@ Object {
229229
"2": Object {
230230
"decl": Object {
231231
"end": Object {
232-
"column": 48,
232+
"column": 49,
233233
"line": 7,
234234
},
235235
"start": Object {
@@ -314,7 +314,7 @@ Object {
314314
},
315315
"5": Object {
316316
"end": Object {
317-
"column": 40,
317+
"column": 43,
318318
"line": 7,
319319
},
320320
"start": Object {
@@ -324,7 +324,7 @@ Object {
324324
},
325325
"6": Object {
326326
"end": Object {
327-
"column": 53,
327+
"column": 54,
328328
"line": 7,
329329
},
330330
"start": Object {

e2e/__tests__/__snapshots__/coverage_report.test.js.snap

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ exports[`generates coverage when using the testRegex config param 1`] = `
4646
"-------------------------------------|----------|----------|----------|----------|-------------------|
4747
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
4848
-------------------------------------|----------|----------|----------|----------|-------------------|
49-
All files </> | 56.52</> | 0</> | 50</> | 55.56</> | </> |
50-
coverage-report </> | 41.18</> | 0</> | 25</> | 42.86</> | </> |
51-
OtherFile.js </> | 100</> | 100</> | 100</> | 100</> | </> |
52-
Sum.js </> | 85.71</> | 100</> | 50</> | 100</> | </> |
53-
SumDependency.js </> | 0</> | 0</> | 0</> | 0</> | 8,10,12</> |
54-
notRequiredInTestSuite.js </> | 0</> | 0</> | 0</> | 0</> | 8,15,16,17,19</> |
55-
coverage-report/cached-duplicates/a</> | 100</> | 100</> | 100</> | 100</> | </> |
56-
Identical.js </> | 100</> | 100</> | 100</> | 100</> | </> |
57-
coverage-report/cached-duplicates/b</> | 100</> | 100</> | 100</> | 100</> | </> |
58-
Identical.js </> | 100</> | 100</> | 100</> | 100</> | </> |
49+
All files | 56.52 | 0 | 50 | 55.56 | |
50+
coverage-report | 41.18 | 0 | 25 | 42.86 | |
51+
OtherFile.js | 100 | 100 | 100 | 100 | |
52+
Sum.js | 85.71 | 100 | 50 | 100 | |
53+
SumDependency.js | 0 | 0 | 0 | 0 | 8,10,12 |
54+
notRequiredInTestSuite.js | 0 | 0 | 0 | 0 | 8,15,16,17,19 |
55+
coverage-report/cached-duplicates/a | 100 | 100 | 100 | 100 | |
56+
Identical.js | 100 | 100 | 100 | 100 | |
57+
coverage-report/cached-duplicates/b | 100 | 100 | 100 | 100 | |
58+
Identical.js | 100 | 100 | 100 | 100 | |
5959
-------------------------------------|----------|----------|----------|----------|-------------------|"
6060
`;
6161

e2e/__tests__/coverage_report.test.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ test('outputs coverage report', () => {
1919
const {stdout, status} = runJest(DIR, ['--no-cache', '--coverage'], {
2020
stripAnsi: true,
2121
});
22-
const coverageDir = path.resolve(__dirname, '../coverage-report/coverage');
22+
const coverageDir = path.join(DIR, 'coverage');
2323

2424
// - the `setup.js` file is ignored and should not be in the coverage report.
2525
// - `SumDependency.js` is mocked and the real module is never required but
@@ -99,14 +99,7 @@ test('outputs coverage report as json', () => {
9999
{stripAnsi: true},
100100
);
101101
expect(status).toBe(0);
102-
103-
try {
104-
JSON.parse(stdout);
105-
} catch (err) {
106-
throw new Error(
107-
"Can't parse the JSON result from stdout. " + err.toString(),
108-
);
109-
}
102+
expect(() => JSON.parse(stdout)).not.toThrow();
110103
});
111104

112105
test('outputs coverage report when text is requested', () => {

e2e/coverage-report/babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: ['@babel/preset-flow'],
3+
};

e2e/coverage-report/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"collectCoverageFrom": [
44
"**/*.js",
55
"!setup.js",
6+
"!babel.config.js",
67
"!**/node_modules/**",
78
"!**/coverage/**"
89
],

e2e/coverage-transform-instrumented/Preprocessor.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
const {transformSync: babelTransform} = require('@babel/core');
99
const {default: babelIstanbulPlugin} = require('babel-plugin-istanbul');
10+
// This is imported from this repo
1011
const jestPreset = require.resolve('babel-preset-jest');
1112

1213
const options = {

e2e/coverage-transform-instrumented/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"dependencies": {
1919
"@babel/core": "^7.0.0",
2020
"@babel/preset-env": "^7.0.0",
21-
"babel-plugin-istanbul": "^5.1.0",
22-
"babel-preset-jest": "^23.2.0"
21+
"babel-core": "^7.0.0-bridge.0",
22+
"babel-plugin-istanbul": "^5.1.0"
2323
}
2424
}

e2e/coverage-transform-instrumented/yarn.lock

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,11 @@ arrify@^1.0.1:
595595
resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d"
596596
integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=
597597

598+
babel-core@^7.0.0-bridge.0:
599+
version "7.0.0-bridge.0"
600+
resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece"
601+
integrity sha512-poPX9mZH/5CSanm50Q+1toVci6pv5KSRv/5TWCwtzQS5XEwn40BcCrgIeMFWP9CKKIniKXNxoIOnOq4VVlGXhg==
602+
598603
babel-plugin-istanbul@^5.1.0:
599604
version "5.1.0"
600605
resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-5.1.0.tgz#6892f529eff65a3e2d33d87dc5888ffa2ecd4a30"
@@ -604,24 +609,6 @@ babel-plugin-istanbul@^5.1.0:
604609
istanbul-lib-instrument "^3.0.0"
605610
test-exclude "^5.0.0"
606611

607-
babel-plugin-jest-hoist@^23.2.0:
608-
version "23.2.0"
609-
resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-23.2.0.tgz#e61fae05a1ca8801aadee57a6d66b8cefaf44167"
610-
integrity sha1-5h+uBaHKiAGq3uV6bWa4zvr0QWc=
611-
612-
babel-plugin-syntax-object-rest-spread@^6.13.0:
613-
version "6.13.0"
614-
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5"
615-
integrity sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=
616-
617-
babel-preset-jest@^23.2.0:
618-
version "23.2.0"
619-
resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-23.2.0.tgz#8ec7a03a138f001a1a8fb1e8113652bf1a55da46"
620-
integrity sha1-jsegOhOPABoaj7HoETZSvxpV2kY=
621-
dependencies:
622-
babel-plugin-jest-hoist "^23.2.0"
623-
babel-plugin-syntax-object-rest-spread "^6.13.0"
624-
625612
balanced-match@^1.0.0:
626613
version "1.0.0"
627614
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"

0 commit comments

Comments
 (0)