forked from vivlabs/coverage-github-reporter
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug fixes and improvements (vivlabs#1)
parse coverage: - return 100 when file is empty/completely skipped (was returning 1) - 100% coverage for parse-coverage.js - fix relative path calculation in github-comment.js - compute common root - format coverage: new emojis in some cases - fix path calculation for links to files in folders - render main coverage link outside of pre tag - don't show unchanged folders in overview - add folder coverage under details - 100% coverage for format-coverage.js - fix links when common root has no coverage - render markdown instead of html where possible
- Loading branch information
1 parent
eb986e6
commit 4424d1d
Showing
30 changed files
with
1,489 additions
and
319 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
coverage/ | ||
node_modules/ | ||
lib/ | ||
test-report.xml | ||
.idea | ||
/coverage/ | ||
/node_modules/ | ||
/lib/ | ||
/test-report.xml | ||
/.idea |
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
This file was deleted.
Oops, something went wrong.
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,56 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`formatComment formats with changes 1`] = ` | ||
" | ||
**[Code Coverage](http://example.com/artifacts/index.html): 30.00% 💔 +11.43% 😀** | ||
<pre> | ||
<a href=\\"http://example.com/artifacts/index.html\\">src/ </a> 10.00% 💔 -8.57% 😭 | ||
<a href=\\"http://example.com/artifacts/bot.js.html\\"> bot.js </a> 100.00% ✅ +100.00% 🎉 | ||
<a href=\\"http://example.com/artifacts/cli.js.html\\"> cli.js </a> 60.00% 💛 +60.00% 😍 | ||
<a href=\\"http://example.com/artifacts/format-coverage.js.html\\"> format-coverage.js</a> 35.00% 💔 -1.13% 😥 | ||
<a href=\\"http://example.com/artifacts/github-comment.js.html\\"> github-comment.js </a> 10.00% 💔 +10.00% 🙂 | ||
<a href=\\"http://example.com/artifacts/parse-coverage.js.html\\"> parse-coverage.js </a> 0.00% ❌ -13.64% 😱 | ||
<a href=\\"http://example.com/artifacts/new-file.js.html\\"> new-file.js </a> 0.00% ❌ | ||
</pre> | ||
<details> | ||
<summary><strong>🗂 Folder Coverage</strong></summary> | ||
<pre> | ||
<a href=\\"http://example.com/artifacts/index.html\\">src/</a> 10.00% 💔 | ||
</pre> | ||
</details> | ||
<p> | ||
From **Circle CI [build 2](http://example.com/build/2)** compared to [build 1](http://example.com/build/1) (from \`master\` branch) – 🤖[coverage-github-reporter](https://github.com/vivlabs/coverage-github-reporter)" | ||
`; | ||
exports[`formatComment formats with no changes 1`] = ` | ||
" | ||
**[Code Coverage](http://example.com/artifacts/index.html): 58.66% 💛** | ||
<details> | ||
<summary><strong>🗂 Folder Coverage</strong></summary> | ||
<pre> | ||
<a href=\\"http://example.com/artifacts/index.html\\">src/ </a> 0.00% ❌ | ||
<a href=\\"http://example.com/artifacts/coverage/index.html\\">src/coverage/</a> 100.00% ✅ | ||
</pre> | ||
</details> | ||
<p> | ||
From **Circle CI [build 2](http://example.com/build/2)** compared to [build 1](http://example.com/build/1) (from \`master\` branch) – 🤖[coverage-github-reporter](https://github.com/vivlabs/coverage-github-reporter)" | ||
`; | ||
exports[`formatComment formats with no prior build 1`] = ` | ||
" | ||
**[Code Coverage](http://example.com/artifacts/index.html): 58.66% 💛** | ||
<details> | ||
<summary><strong>🗂 Folder Coverage</strong></summary> | ||
<pre> | ||
<a href=\\"http://example.com/artifacts/index.html\\">src/ </a> 0.00% ❌ | ||
<a href=\\"http://example.com/artifacts/coverage/index.html\\">src/coverage/</a> 100.00% ✅ | ||
</pre> | ||
</details> | ||
<p> | ||
From **Circle CI [build 2](http://example.com/build/2)** – 🤖[coverage-github-reporter](https://github.com/vivlabs/coverage-github-reporter)" | ||
`; |
This file was deleted.
Oops, something went wrong.
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,67 @@ | ||
/* eslint-env jest */ | ||
|
||
const { formatComment } = require('../github-comment') | ||
|
||
describe('formatComment', () => { | ||
it('formats with no prior build', () => { | ||
expect(formatComment({ | ||
formatted: { | ||
'changed': '', | ||
'folders': `<pre> | ||
<a href="http://example.com/artifacts/index.html">src/ </a> 0.00% ❌ | ||
<a href="http://example.com/artifacts/coverage/index.html">src/coverage/</a> 100.00% ✅ | ||
</pre>`, | ||
'status': '58.66% 💛' | ||
}, | ||
baseArtifactUrl: 'http://example.com/artifacts', | ||
buildNum: 2, | ||
buildUrl: 'http://example.com/build/2', | ||
branch: 'master' | ||
})).toMatchSnapshot() | ||
}) | ||
|
||
it('formats with no changes', () => { | ||
expect(formatComment({ | ||
formatted: { | ||
'changed': '', | ||
'folders': `<pre> | ||
<a href="http://example.com/artifacts/index.html">src/ </a> 0.00% ❌ | ||
<a href="http://example.com/artifacts/coverage/index.html">src/coverage/</a> 100.00% ✅ | ||
</pre>`, | ||
'status': '58.66% 💛' | ||
}, | ||
baseArtifactUrl: 'http://example.com/artifacts', | ||
buildNum: 2, | ||
buildUrl: 'http://example.com/build/2', | ||
priorBuildNum: 1, | ||
priorBuildUrl: 'http://example.com/build/1', | ||
branch: 'master' | ||
})).toMatchSnapshot() | ||
}) | ||
|
||
it('formats with changes', () => { | ||
expect(formatComment({ | ||
formatted: { | ||
'changed': `<pre> | ||
<a href="http://example.com/artifacts/index.html">src/ </a> 10.00% 💔 -8.57% 😭 | ||
<a href="http://example.com/artifacts/bot.js.html"> bot.js </a> 100.00% ✅ +100.00% 🎉 | ||
<a href="http://example.com/artifacts/cli.js.html"> cli.js </a> 60.00% 💛 +60.00% 😍 | ||
<a href="http://example.com/artifacts/format-coverage.js.html"> format-coverage.js</a> 35.00% 💔 -1.13% 😥 | ||
<a href="http://example.com/artifacts/github-comment.js.html"> github-comment.js </a> 10.00% 💔 +10.00% 🙂 | ||
<a href="http://example.com/artifacts/parse-coverage.js.html"> parse-coverage.js </a> 0.00% ❌ -13.64% 😱 | ||
<a href="http://example.com/artifacts/new-file.js.html"> new-file.js </a> 0.00% ❌ | ||
</pre>`, | ||
'folders': `<pre> | ||
<a href="http://example.com/artifacts/index.html">src/</a> 10.00% 💔 | ||
</pre>`, | ||
'status': '30.00% 💔 +11.43% 😀' | ||
}, | ||
baseArtifactUrl: 'http://example.com/artifacts', | ||
buildNum: 2, | ||
buildUrl: 'http://example.com/build/2', | ||
priorBuildNum: 1, | ||
priorBuildUrl: 'http://example.com/build/1', | ||
branch: 'master' | ||
})).toMatchSnapshot() | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.