Skip to content

Commit

Permalink
fix: do not print empty tables if no coverage report
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandermendes committed Nov 2, 2020
1 parent 8afa0fd commit 260e822
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions tests/specs/coverage.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,4 +402,12 @@ describe('Coverage', () => {
expect(lines).toContain('|[src/one.js](../blob/abc123/src/one.js)|100|100|100|100|:white_check_mark:|');
expect(lines).toContain('|[src/two.js](../blob/abc123/src/two.js)|100|100|100|100|:white_check_mark:|');
});

it('does not report anything if no coverage reported for the files changed', async () => {
mockFs();

await coverage();

expect(getMarkdownReport()).toBeUndefined();
});
});
2 changes: 1 addition & 1 deletion tests/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const getFileXml = (filePath, metrics, lines = []) => `
</file>
`;

export const getMarkdownReport = () => markdown.mock.calls[0][0];
export const getMarkdownReport = () => markdown.mock.calls?.[0]?.[0];

export const translateMetric = (metric) => ({
statements: 'statements',
Expand Down

0 comments on commit 260e822

Please sign in to comment.