Skip to content

Commit

Permalink
fix: remove diagnostics from summary (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
MoLow authored Feb 1, 2024
1 parent e63d34a commit 1e95cf0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
4 changes: 3 additions & 1 deletion packages/github/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ module.exports = async function githubReporter(source) {
counter.fail += 1;
break;
} case 'test:diagnostic':
if (event.data.nesting === 0) {
if (event.data.file === undefined
|| event.data.line === undefined
|| event.data.column === undefined) {
diagnostics.push(event.data.message);
} else {
core.notice(event.data.message, extractLocation(event.data));
Expand Down
16 changes: 11 additions & 5 deletions packages/github/tests/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@ module.exports = {
::debug::completed running is skipped
::debug::starting to run is a todo
::debug::completed running is a todo
::group::Test results \\(3 passed, 2 failed\\)
::notice::Total Tests: 7%0ASuites 📂: 2%0APassed ✅: 3%0AFailed ❌: 2%0ACanceled 🚫: 0%0ASkipped ⏭️: 1%0ATodo 📝: 1%0ADuration 🕐: .*ms
::debug::starting to run top level diagnostic
::debug::completed running top level diagnostic
::notice file=tests/example.js,line=21,col=1::top level diagnostic
::group::Test results \\(4 passed, 2 failed\\)
::notice::Total Tests: 8%0ASuites 📂: 2%0APassed ✅: 4%0AFailed ❌: 2%0ACanceled 🚫: 0%0ASkipped ⏭️: 1%0ATodo 📝: 1%0ADuration 🕐: .*ms
::endgroup::
`,
summary: `<h1>Test Results</h1>
<table><tr><td>Total Tests</td><td>7</td></tr><tr><td>Suites 📂</td><td>2</td></tr><tr><td>Passed ✅</td><td>3</td></tr><tr><td>Failed ❌</td><td>2</td></tr><tr><td>Canceled 🚫</td><td>0</td></tr><tr><td>Skipped ⏭️</td><td>1</td></tr><tr><td>Todo 📝</td><td>1</td></tr><tr><td>Duration 🕐</td><td>.*ms</td></tr></table>
<table><tr><td>Total Tests</td><td>8</td></tr><tr><td>Suites 📂</td><td>2</td></tr><tr><td>Passed ✅</td><td>4</td></tr><tr><td>Failed ❌</td><td>2</td></tr><tr><td>Canceled 🚫</td><td>0</td></tr><tr><td>Skipped ⏭️</td><td>1</td></tr><tr><td>Todo 📝</td><td>1</td></tr><tr><td>Duration 🕐</td><td>.*ms</td></tr></table>
`,
overrides: {
18: {
Expand All @@ -46,8 +49,11 @@ module.exports = {
::debug::completed running is skipped
::debug::starting to run is a todo
::debug::completed running is a todo
::group::Test results \\(3 passed, 2 failed\\)
::notice::Total Tests: 7%0ASuites 📂: 2%0APassed ✅: 3%0AFailed ❌: 2%0ACanceled 🚫: 0%0ASkipped ⏭️: 1%0ATodo 📝: 1%0ADuration 🕐: .*ms
::debug::starting to run top level diagnostic
::debug::completed running top level diagnostic
::notice file=tests/example.js,line=21,col=1::top level diagnostic
::group::Test results \\(4 passed, 2 failed\\)
::notice::Total Tests: 8%0ASuites 📂: 2%0APassed ✅: 4%0AFailed ❌: 2%0ACanceled 🚫: 0%0ASkipped ⏭️: 1%0ATodo 📝: 1%0ADuration 🕐: .*ms
::endgroup::
`,
},
Expand Down
2 changes: 2 additions & 0 deletions packages/junit/tests/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ cause: AssertionError \\[ERR_ASSERTION\\]: The expression evaluated to a falsy v
\t<testcase name="is a todo" time=".*" classname="test">
\t\t<skipped type="todo" message="true"/>
\t</testcase>
\t<testcase name="top level diagnostic" time=".*" classname="test"/>
</testsuites>
`,
overrides: {
Expand Down Expand Up @@ -127,6 +128,7 @@ code: 'ERR_TEST_FAILURE'
\t<testcase name="is a todo" time=".*" classname="test">
\t\t<skipped type="todo" message="true"/>
\t</testcase>
\t<testcase name="top level diagnostic" time=".*" classname="test"/>
</testsuites>
`,
},
Expand Down
2 changes: 2 additions & 0 deletions tests/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ describe('more tests', () => {
});
it.skip('is skipped', () => {});
it.todo('is a todo');

test('top level diagnostic', async (t) => { t.diagnostic('top level diagnostic'); });

0 comments on commit 1e95cf0

Please sign in to comment.