From fef7927cc3a7a3fb81c355301aada4a679c5661c Mon Sep 17 00:00:00 2001 From: Moshe Atlow Date: Wed, 27 Sep 2023 02:01:14 +0300 Subject: [PATCH] test: deflake test-runner-output PR-URL: https://github.com/nodejs/node/pull/49878 Fixes: https://github.com/nodejs/node/issues/49853 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Geoffrey Booth Reviewed-By: Chemi Atlow --- test/fixtures/test-runner/output/abort.snapshot | 16 ++++++++-------- .../test-runner/output/abort_hooks.snapshot | 4 ++-- .../test-runner/output/abort_suite.snapshot | 8 ++++---- .../test-runner/output/arbitrary-output.snapshot | 6 +++--- .../test-runner/output/describe_it.snapshot | 4 ++-- test/fixtures/test-runner/output/hooks.snapshot | 4 ++-- .../output/unresolved_promise.snapshot | 2 +- test/parallel/test-runner-output.mjs | 3 --- 8 files changed, 22 insertions(+), 25 deletions(-) diff --git a/test/fixtures/test-runner/output/abort.snapshot b/test/fixtures/test-runner/output/abort.snapshot index ceca09da14bfb1..1b758a2314c486 100644 --- a/test/fixtures/test-runner/output/abort.snapshot +++ b/test/fixtures/test-runner/output/abort.snapshot @@ -32,7 +32,7 @@ TAP version 13 # Subtest: not ok 2 not ok 6 - not ok 2 --- - duration_ms: ZERO + duration_ms: * location: '/test/fixtures/test-runner/output/abort.js:(LINE):7' failureType: 'cancelledByParent' error: 'test did not finish before its parent and was cancelled' @@ -41,7 +41,7 @@ TAP version 13 # Subtest: not ok 3 not ok 7 - not ok 3 --- - duration_ms: ZERO + duration_ms: * location: '/test/fixtures/test-runner/output/abort.js:(LINE):7' failureType: 'testAborted' error: 'This operation was aborted' @@ -62,7 +62,7 @@ TAP version 13 # Subtest: not ok 4 not ok 8 - not ok 4 --- - duration_ms: ZERO + duration_ms: * location: '/test/fixtures/test-runner/output/abort.js:(LINE):7' failureType: 'testAborted' error: 'This operation was aborted' @@ -83,7 +83,7 @@ TAP version 13 # Subtest: not ok 5 not ok 9 - not ok 5 --- - duration_ms: ZERO + duration_ms: * location: '/test/fixtures/test-runner/output/abort.js:(LINE):7' failureType: 'testAborted' error: 'This operation was aborted' @@ -169,7 +169,7 @@ not ok 2 - promise abort signal # Subtest: not ok 2 not ok 6 - not ok 2 --- - duration_ms: ZERO + duration_ms: * location: '/test/fixtures/test-runner/output/abort.js:(LINE):5' failureType: 'cancelledByParent' error: 'test did not finish before its parent and was cancelled' @@ -178,7 +178,7 @@ not ok 2 - promise abort signal # Subtest: not ok 3 not ok 7 - not ok 3 --- - duration_ms: ZERO + duration_ms: * location: '/test/fixtures/test-runner/output/abort.js:(LINE):5' failureType: 'testAborted' error: 'This operation was aborted' @@ -199,7 +199,7 @@ not ok 2 - promise abort signal # Subtest: not ok 4 not ok 8 - not ok 4 --- - duration_ms: ZERO + duration_ms: * location: '/test/fixtures/test-runner/output/abort.js:(LINE):5' failureType: 'testAborted' error: 'This operation was aborted' @@ -220,7 +220,7 @@ not ok 2 - promise abort signal # Subtest: not ok 5 not ok 9 - not ok 5 --- - duration_ms: ZERO + duration_ms: * location: '/test/fixtures/test-runner/output/abort.js:(LINE):5' failureType: 'testAborted' error: 'This operation was aborted' diff --git a/test/fixtures/test-runner/output/abort_hooks.snapshot b/test/fixtures/test-runner/output/abort_hooks.snapshot index d0b567bb6a22cd..278b5e5fd36ca5 100644 --- a/test/fixtures/test-runner/output/abort_hooks.snapshot +++ b/test/fixtures/test-runner/output/abort_hooks.snapshot @@ -11,7 +11,7 @@ TAP version 13 # Subtest: test 1 not ok 1 - test 1 --- - duration_ms: ZERO + duration_ms: * location: '/test/fixtures/test-runner/output/abort_hooks.js:(LINE):3' failureType: 'cancelledByParent' error: 'test did not finish before its parent and was cancelled' @@ -20,7 +20,7 @@ TAP version 13 # Subtest: test 2 not ok 2 - test 2 --- - duration_ms: ZERO + duration_ms: * location: '/test/fixtures/test-runner/output/abort_hooks.js:(LINE):3' failureType: 'cancelledByParent' error: 'test did not finish before its parent and was cancelled' diff --git a/test/fixtures/test-runner/output/abort_suite.snapshot b/test/fixtures/test-runner/output/abort_suite.snapshot index e7e8c4f4e2360f..30d48d236ff4a5 100644 --- a/test/fixtures/test-runner/output/abort_suite.snapshot +++ b/test/fixtures/test-runner/output/abort_suite.snapshot @@ -32,7 +32,7 @@ TAP version 13 # Subtest: not ok 2 not ok 6 - not ok 2 --- - duration_ms: ZERO + duration_ms: * location: '/test/fixtures/test-runner/output/abort_suite.js:(LINE):3' failureType: 'cancelledByParent' error: 'test did not finish before its parent and was cancelled' @@ -41,7 +41,7 @@ TAP version 13 # Subtest: not ok 3 not ok 7 - not ok 3 --- - duration_ms: ZERO + duration_ms: * location: '/test/fixtures/test-runner/output/abort_suite.js:(LINE):3' failureType: 'testAborted' error: 'This operation was aborted' @@ -62,7 +62,7 @@ TAP version 13 # Subtest: not ok 4 not ok 8 - not ok 4 --- - duration_ms: ZERO + duration_ms: * location: '/test/fixtures/test-runner/output/abort_suite.js:(LINE):3' failureType: 'testAborted' error: 'This operation was aborted' @@ -83,7 +83,7 @@ TAP version 13 # Subtest: not ok 5 not ok 9 - not ok 5 --- - duration_ms: ZERO + duration_ms: * location: '/test/fixtures/test-runner/output/abort_suite.js:(LINE):3' failureType: 'testAborted' error: 'This operation was aborted' diff --git a/test/fixtures/test-runner/output/arbitrary-output.snapshot b/test/fixtures/test-runner/output/arbitrary-output.snapshot index 2389096398cd09..601aaa42f3c74a 100644 --- a/test/fixtures/test-runner/output/arbitrary-output.snapshot +++ b/test/fixtures/test-runner/output/arbitrary-output.snapshot @@ -1,17 +1,17 @@ TAP version 13 ok 1 - test --- - duration_ms: ZERO + duration_ms: * ... # arbitrary - pre ok 2 - test --- - duration_ms: ZERO + duration_ms: * ... # arbitrary - mid ok 3 - test --- - duration_ms: ZERO + duration_ms: * ... # arbitrary - post 1..3 diff --git a/test/fixtures/test-runner/output/describe_it.snapshot b/test/fixtures/test-runner/output/describe_it.snapshot index be345f11575c8d..1d4f7853ead0d1 100644 --- a/test/fixtures/test-runner/output/describe_it.snapshot +++ b/test/fixtures/test-runner/output/describe_it.snapshot @@ -513,7 +513,7 @@ not ok 51 - subtest sync throw fails # Subtest: should not run not ok 1 - should not run --- - duration_ms: ZERO + duration_ms: * location: '/test/fixtures/test-runner/output/describe_it.js:(LINE):3' failureType: 'cancelledByParent' error: 'test did not finish before its parent and was cancelled' @@ -544,7 +544,7 @@ not ok 52 - describe sync throw fails # Subtest: should not run not ok 1 - should not run --- - duration_ms: ZERO + duration_ms: * location: '/test/fixtures/test-runner/output/describe_it.js:(LINE):3' failureType: 'cancelledByParent' error: 'test did not finish before its parent and was cancelled' diff --git a/test/fixtures/test-runner/output/hooks.snapshot b/test/fixtures/test-runner/output/hooks.snapshot index 5afe398ed3d0ea..6cf29612c535cb 100644 --- a/test/fixtures/test-runner/output/hooks.snapshot +++ b/test/fixtures/test-runner/output/hooks.snapshot @@ -37,7 +37,7 @@ ok 1 - describe hooks # Subtest: 1 not ok 1 - 1 --- - duration_ms: ZERO + duration_ms: * location: '/test/fixtures/test-runner/output/hooks.js:(LINE):3' failureType: 'cancelledByParent' error: 'test did not finish before its parent and was cancelled' @@ -46,7 +46,7 @@ ok 1 - describe hooks # Subtest: 2 not ok 2 - 2 --- - duration_ms: ZERO + duration_ms: * location: '/test/fixtures/test-runner/output/hooks.js:(LINE):3' failureType: 'cancelledByParent' error: 'test did not finish before its parent and was cancelled' diff --git a/test/fixtures/test-runner/output/unresolved_promise.snapshot b/test/fixtures/test-runner/output/unresolved_promise.snapshot index 839ec311a65e04..0090885468c338 100644 --- a/test/fixtures/test-runner/output/unresolved_promise.snapshot +++ b/test/fixtures/test-runner/output/unresolved_promise.snapshot @@ -18,7 +18,7 @@ not ok 2 - never resolving promise # Subtest: fail not ok 3 - fail --- - duration_ms: ZERO + duration_ms: * location: '/test/fixtures/test-runner/output/unresolved_promise.js:(LINE):1' failureType: 'cancelledByParent' error: 'Promise resolution is still pending but the event loop has already resolved' diff --git a/test/parallel/test-runner-output.mjs b/test/parallel/test-runner-output.mjs index fff6fed92655e9..372ca8f3bae0ff 100644 --- a/test/parallel/test-runner-output.mjs +++ b/test/parallel/test-runner-output.mjs @@ -10,7 +10,6 @@ const skipForceColors = function replaceTestDuration(str) { return str - .replaceAll(/duration_ms: 0(\r?\n)/g, 'duration_ms: ZERO$1') .replaceAll(/duration_ms: [0-9.]+/g, 'duration_ms: *') .replaceAll(/duration_ms [0-9.]+/g, 'duration_ms *'); } @@ -20,7 +19,6 @@ const stackTraceBasePath = new RegExp(`${color}\\(${process.cwd()}/?${color}(.*) function replaceSpecDuration(str) { return str - .replaceAll(/\(0(\r?\n)ms\)/g, '(ZEROms)') .replaceAll(/[0-9.]+ms/g, '*ms') .replaceAll(/duration_ms [0-9.]+/g, 'duration_ms *') .replace(stackTraceBasePath, '$3'); @@ -28,7 +26,6 @@ function replaceSpecDuration(str) { function replaceJunitDuration(str) { return str - .replaceAll(/time="0"/g, 'time="ZERO"') .replaceAll(/time="[0-9.]+"/g, 'time="*"') .replaceAll(/duration_ms [0-9.]+/g, 'duration_ms *') .replaceAll(hostname(), 'HOSTNAME')