Skip to content

Commit

Permalink
coverage?
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Nov 20, 2018
1 parent ba9ac39 commit e43b024
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 22 deletions.
26 changes: 13 additions & 13 deletions e2e/__tests__/__snapshots__/coverage_report.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ exports[`outputs coverage report 1`] = `
"-------------------------------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
-------------------------------------|----------|----------|----------|----------|-------------------|
All files | 56.52 | 0 | 50 | 55.56 | |
coverage-report | 41.18 | 0 | 25 | 42.86 | |
All files | 59.09 | 0 | 50 | 58.82 | |
coverage-report | 43.75 | 0 | 25 | 46.15 | |
OtherFile.js | 100 | 100 | 100 | 100 | |
Sum.js | 85.71 | 100 | 50 | 100 | |
SumDependency.js | 0 | 0 | 0 | 0 | 8,10,12 |
notRequiredInTestSuite.js | 0 | 0 | 0 | 0 | 8,15,16,17,19 |
notRequiredInTestSuite.js | 0 | 0 | 0 | 0 | 15,16,17,19 |
coverage-report/cached-duplicates/a | 100 | 100 | 100 | 100 | |
Identical.js | 100 | 100 | 100 | 100 | |
coverage-report/cached-duplicates/b | 100 | 100 | 100 | 100 | |
Expand All @@ -88,20 +88,20 @@ All files | 56.52 | 0 | 50 | 55.56
exports[`outputs coverage report when text and text-summary is requested 1`] = `
"
=============================== Coverage summary ===============================
Statements : 56.52% ( 13/23 )
Statements : 59.09% ( 13/22 )
Branches : 0% ( 0/4 )
Functions : 50% ( 3/6 )
Lines : 55.56% ( 10/18 )
Lines : 58.82% ( 10/17 )
================================================================================
-------------------------------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
-------------------------------------|----------|----------|----------|----------|-------------------|
All files | 56.52 | 0 | 50 | 55.56 | |
coverage-report | 41.18 | 0 | 25 | 42.86 | |
All files | 59.09 | 0 | 50 | 58.82 | |
coverage-report | 43.75 | 0 | 25 | 46.15 | |
OtherFile.js | 100 | 100 | 100 | 100 | |
Sum.js | 85.71 | 100 | 50 | 100 | |
SumDependency.js | 0 | 0 | 0 | 0 | 8,10,12 |
notRequiredInTestSuite.js | 0 | 0 | 0 | 0 | 8,15,16,17,19 |
notRequiredInTestSuite.js | 0 | 0 | 0 | 0 | 15,16,17,19 |
coverage-report/cached-duplicates/a | 100 | 100 | 100 | 100 | |
Identical.js | 100 | 100 | 100 | 100 | |
coverage-report/cached-duplicates/b | 100 | 100 | 100 | 100 | |
Expand All @@ -113,12 +113,12 @@ exports[`outputs coverage report when text is requested 1`] = `
"-------------------------------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
-------------------------------------|----------|----------|----------|----------|-------------------|
All files | 56.52 | 0 | 50 | 55.56 | |
coverage-report | 41.18 | 0 | 25 | 42.86 | |
All files | 59.09 | 0 | 50 | 58.82 | |
coverage-report | 43.75 | 0 | 25 | 46.15 | |
OtherFile.js | 100 | 100 | 100 | 100 | |
Sum.js | 85.71 | 100 | 50 | 100 | |
SumDependency.js | 0 | 0 | 0 | 0 | 8,10,12 |
notRequiredInTestSuite.js | 0 | 0 | 0 | 0 | 8,15,16,17,19 |
notRequiredInTestSuite.js | 0 | 0 | 0 | 0 | 15,16,17,19 |
coverage-report/cached-duplicates/a | 100 | 100 | 100 | 100 | |
Identical.js | 100 | 100 | 100 | 100 | |
coverage-report/cached-duplicates/b | 100 | 100 | 100 | 100 | |
Expand All @@ -129,9 +129,9 @@ All files | 56.52 | 0 | 50 | 55.56
exports[`outputs coverage report when text-summary is requested 1`] = `
"
=============================== Coverage summary ===============================
Statements : 56.52% ( 13/23 )
Statements : 59.09% ( 13/22 )
Branches : 0% ( 0/4 )
Functions : 50% ( 3/6 )
Lines : 55.56% ( 10/18 )
Lines : 58.82% ( 10/17 )
================================================================================"
`;
11 changes: 2 additions & 9 deletions e2e/__tests__/coverage_report.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test('outputs coverage report', () => {
const {stdout, status} = runJest(DIR, ['--no-cache', '--coverage'], {
stripAnsi: true,
});
const coverageDir = path.resolve(__dirname, '../coverage-report/coverage');
const coverageDir = path.join(DIR, 'coverage');

// - the `setup.js` file is ignored and should not be in the coverage report.
// - `SumDependency.js` is mocked and the real module is never required but
Expand Down Expand Up @@ -99,14 +99,7 @@ test('outputs coverage report as json', () => {
{stripAnsi: true},
);
expect(status).toBe(0);

try {
JSON.parse(stdout);
} catch (err) {
throw new Error(
"Can't parse the JSON result from stdout. " + err.toString(),
);
}
expect(() => JSON.parse(stdout)).not.toThrow();
});

test('outputs coverage report when text is requested', () => {
Expand Down
3 changes: 3 additions & 0 deletions e2e/coverage-report/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ['@babel/preset-flow'],
};
1 change: 1 addition & 0 deletions e2e/coverage-report/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"collectCoverageFrom": [
"**/*.js",
"!setup.js",
"!babel.config.js",
"!**/node_modules/**",
"!**/coverage/**"
],
Expand Down

0 comments on commit e43b024

Please sign in to comment.