From 1e95cf0bab16785073715238b42b9fb8baebbc43 Mon Sep 17 00:00:00 2001 From: Moshe Atlow Date: Thu, 1 Feb 2024 14:51:33 +0200 Subject: [PATCH] fix: remove diagnostics from summary (#113) --- packages/github/index.js | 4 +++- packages/github/tests/output.js | 16 +++++++++++----- packages/junit/tests/output.js | 2 ++ tests/example.js | 2 ++ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/packages/github/index.js b/packages/github/index.js index f5060be..97adf8c 100644 --- a/packages/github/index.js +++ b/packages/github/index.js @@ -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)); diff --git a/packages/github/tests/output.js b/packages/github/tests/output.js index 914d7a2..5313c8c 100644 --- a/packages/github/tests/output.js +++ b/packages/github/tests/output.js @@ -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: `

Test Results

-
Total Tests7
Suites 📂2
Passed ✅3
Failed ❌2
Canceled 🚫0
Skipped ⏭️1
Todo 📝1
Duration 🕐.*ms
+
Total Tests8
Suites 📂2
Passed ✅4
Failed ❌2
Canceled 🚫0
Skipped ⏭️1
Todo 📝1
Duration 🕐.*ms
`, overrides: { 18: { @@ -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:: `, }, diff --git a/packages/junit/tests/output.js b/packages/junit/tests/output.js index 6e6cc1c..b18389d 100644 --- a/packages/junit/tests/output.js +++ b/packages/junit/tests/output.js @@ -62,6 +62,7 @@ cause: AssertionError \\[ERR_ASSERTION\\]: The expression evaluated to a falsy v \t \t\t \t +\t `, overrides: { @@ -127,6 +128,7 @@ code: 'ERR_TEST_FAILURE' \t \t\t \t +\t `, }, diff --git a/tests/example.js b/tests/example.js index 7a0e9b7..da9e06b 100644 --- a/tests/example.js +++ b/tests/example.js @@ -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'); });