diff options
author | MURAKAMI Masahiko <m-murakami@esm.co.jp> | 2022-04-28 00:42:56 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-28 00:42:56 +0300 |
commit | 8cbc39068cd102e3bbdb6c5a1d14ce450e6ef093 (patch) | |
tree | 1174bc5132270de270e7ea501fb15a89bb1925a3 /test | |
parent | 8d0f49c09355647f711eb14ec3a22471dbd056b3 (diff) |
test: improve lib/internal/test_runner/test.js coverage
PR-URL: https://github.com/nodejs/node/pull/42745
Refs: https://coverage.nodejs.org/coverage-24adba675179ebba/lib/internal/test_runner/test.js.html#L371
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/message/test_runner_output.js | 9 | ||||
-rw-r--r-- | test/message/test_runner_output.out | 52 |
2 files changed, 57 insertions, 4 deletions
diff --git a/test/message/test_runner_output.js b/test/message/test_runner_output.js index d397f1ee7a2..c586199f0d9 100644 --- a/test/message/test_runner_output.js +++ b/test/message/test_runner_output.js @@ -319,3 +319,12 @@ test('custom inspect symbol that throws fail', () => { throw obj; }); + +test('subtest sync throw fails', async (t) => { + await t.test('sync throw fails at first', (t) => { + throw new Error('thrown from subtest sync throw fails at first'); + }); + await t.test('sync throw fails at second', (t) => { + throw new Error('thrown from subtest sync throw fails at second'); + }); +}); diff --git a/test/message/test_runner_output.out b/test/message/test_runner_output.out index 866b498deab..6c2fa7eb14c 100644 --- a/test/message/test_runner_output.out +++ b/test/message/test_runner_output.out @@ -448,7 +448,51 @@ not ok 55 - custom inspect symbol that throws fail } code: 'ERR_TEST_FAILURE' ... -not ok 56 - invalid subtest fail + not ok 1 - sync throw fails at first + --- + duration_ms: * + failureType: 'testCodeFailure' + error: 'thrown from subtest sync throw fails at first' + code: 'ERR_TEST_FAILURE' + stack: |- + * + * + * + * + * + * + * + * + * + * + ... + not ok 2 - sync throw fails at second + --- + duration_ms: * + failureType: 'testCodeFailure' + error: 'thrown from subtest sync throw fails at second' + code: 'ERR_TEST_FAILURE' + stack: |- + * + * + * + * + * + * + * + * + * + * + ... + 1..2 +not ok 56 - subtest sync throw fails + --- + duration_ms: * + failureType: 'subtestsFailed' + error: '2 subtests failed' + code: 'ERR_TEST_FAILURE' + ... +not ok 57 - invalid subtest fail --- duration_ms: * failureType: 'parentAlreadyFinished' @@ -457,16 +501,16 @@ not ok 56 - invalid subtest fail stack: |- * ... -1..56 +1..57 # Warning: Test "unhandled rejection - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. # Warning: Test "async unhandled rejection - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from async unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. # Warning: Test "immediate throw - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: thrown from immediate throw fail" and would have caused the test to fail, but instead triggered an uncaughtException event. # Warning: Test "immediate reject - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from immediate reject fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. # Warning: Test "callback called twice in different ticks" generated asynchronous activity after the test ended. This activity created the error "Error [ERR_TEST_FAILURE]: callback invoked multiple times" and would have caused the test to fail, but instead triggered an uncaughtException event. # Warning: Test "callback async throw after done" generated asynchronous activity after the test ended. This activity created the error "Error: thrown from callback async throw after done" and would have caused the test to fail, but instead triggered an uncaughtException event. -# tests 56 +# tests 57 # pass 24 -# fail 17 +# fail 18 # skipped 10 # todo 5 # duration_ms * |