From bd80ca5fb40fa8eab57a3401c702d9ec95c6a5a2 Mon Sep 17 00:00:00 2001 From: Sergey Chernyshev Date: Thu, 25 Apr 2024 04:22:22 +0200 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 --- .../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 ++-- .../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/graal-nodejs/test/fixtures/test-runner/output/abort.snapshot b/graal-nodejs/test/fixtures/test-runner/output/abort.snapshot index ceca09da14b..1b758a2314c 100644 --- a/graal-nodejs/test/fixtures/test-runner/output/abort.snapshot +++ b/graal-nodejs/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/graal-nodejs/test/fixtures/test-runner/output/abort_hooks.snapshot b/graal-nodejs/test/fixtures/test-runner/output/abort_hooks.snapshot index d0b567bb6a2..278b5e5fd36 100644 --- a/graal-nodejs/test/fixtures/test-runner/output/abort_hooks.snapshot +++ b/graal-nodejs/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/graal-nodejs/test/fixtures/test-runner/output/abort_suite.snapshot b/graal-nodejs/test/fixtures/test-runner/output/abort_suite.snapshot index e7e8c4f4e23..30d48d236ff 100644 --- a/graal-nodejs/test/fixtures/test-runner/output/abort_suite.snapshot +++ b/graal-nodejs/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/graal-nodejs/test/fixtures/test-runner/output/arbitrary-output.snapshot b/graal-nodejs/test/fixtures/test-runner/output/arbitrary-output.snapshot index 2389096398c..601aaa42f3c 100644 --- a/graal-nodejs/test/fixtures/test-runner/output/arbitrary-output.snapshot +++ b/graal-nodejs/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/graal-nodejs/test/fixtures/test-runner/output/describe_it.snapshot b/graal-nodejs/test/fixtures/test-runner/output/describe_it.snapshot index be345f11575..1d4f7853ead 100644 --- a/graal-nodejs/test/fixtures/test-runner/output/describe_it.snapshot +++ b/graal-nodejs/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/graal-nodejs/test/fixtures/test-runner/output/hooks.snapshot b/graal-nodejs/test/fixtures/test-runner/output/hooks.snapshot index 5afe398ed3d..6cf29612c53 100644 --- a/graal-nodejs/test/fixtures/test-runner/output/hooks.snapshot +++ b/graal-nodejs/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/graal-nodejs/test/fixtures/test-runner/output/unresolved_promise.snapshot b/graal-nodejs/test/fixtures/test-runner/output/unresolved_promise.snapshot index 839ec311a65..0090885468c 100644 --- a/graal-nodejs/test/fixtures/test-runner/output/unresolved_promise.snapshot +++ b/graal-nodejs/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/graal-nodejs/test/parallel/test-runner-output.mjs b/graal-nodejs/test/parallel/test-runner-output.mjs index fff6fed9265..372ca8f3bae 100644 --- a/graal-nodejs/test/parallel/test-runner-output.mjs +++ b/graal-nodejs/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')