From 0a28ef20915561035cd3f31c697f990d3f3e1762 Mon Sep 17 00:00:00 2001 From: Vaishnavi J K Date: Wed, 18 Mar 2026 21:42:09 +0530 Subject: [PATCH 1/6] test_runner: make skip/todo/expectFailure use JS truthiness (#61815) --- lib/internal/test_runner/test.js | 2 +- test/parallel/test-runner-skip-empty-string.js | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 test/parallel/test-runner-skip-empty-string.js diff --git a/lib/internal/test_runner/test.js b/lib/internal/test_runner/test.js index 97d53c097261d7..32bdb486cec438 100644 --- a/lib/internal/test_runner/test.js +++ b/lib/internal/test_runner/test.js @@ -679,7 +679,7 @@ class Test extends AsyncResource { this.expectedAssertions = plan; this.cancelled = false; this.expectFailure = parseExpectFailure(expectFailure) || this.parent?.expectFailure; - this.skipped = skip !== undefined && skip !== false; + this.skipped = Boolean(skip); this.isTodo = (todo !== undefined && todo !== false) || this.parent?.isTodo; this.startTime = null; this.endTime = null; diff --git a/test/parallel/test-runner-skip-empty-string.js b/test/parallel/test-runner-skip-empty-string.js new file mode 100644 index 00000000000000..c348f44d7c9206 --- /dev/null +++ b/test/parallel/test-runner-skip-empty-string.js @@ -0,0 +1,13 @@ +'use strict'; +const { test } = require('node:test'); +const assert = require('assert'); + +let ran = false; + +test('skip option empty string should not skip', { skip: '' }, () => { + ran = true; +}); + +process.on('exit', () => { + assert.ok(ran); +}); \ No newline at end of file From c96d866eba195af83f4210da20db94e34d53a799 Mon Sep 17 00:00:00 2001 From: Vaishnavi J K Date: Fri, 20 Mar 2026 12:46:49 +0530 Subject: [PATCH 2/6] test_runner:make skip/todo/expectFailure use JS truthiness (#61815) --- lib/internal/test_runner/test.js | 1 + test/parallel/test-runner-skip-empty-string.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/internal/test_runner/test.js b/lib/internal/test_runner/test.js index 32bdb486cec438..9c25d48639d37c 100644 --- a/lib/internal/test_runner/test.js +++ b/lib/internal/test_runner/test.js @@ -9,6 +9,7 @@ const { ArrayPrototypeSplice, ArrayPrototypeUnshift, ArrayPrototypeUnshiftApply, + Boolean, Error, FunctionPrototype, MathMax, diff --git a/test/parallel/test-runner-skip-empty-string.js b/test/parallel/test-runner-skip-empty-string.js index c348f44d7c9206..799f8d1585859c 100644 --- a/test/parallel/test-runner-skip-empty-string.js +++ b/test/parallel/test-runner-skip-empty-string.js @@ -1,4 +1,6 @@ 'use strict'; +require('../common'); + const { test } = require('node:test'); const assert = require('assert'); @@ -10,4 +12,4 @@ test('skip option empty string should not skip', { skip: '' }, () => { process.on('exit', () => { assert.ok(ran); -}); \ No newline at end of file +}); From 58be01d6a8939741f41184a145831f85d68b4d65 Mon Sep 17 00:00:00 2001 From: Vaishnavi J K Date: Fri, 20 Mar 2026 17:34:05 +0530 Subject: [PATCH 3/6] test: use common.mustCall() for skip empty string test --- test/parallel/test-runner-skip-empty-string.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/test/parallel/test-runner-skip-empty-string.js b/test/parallel/test-runner-skip-empty-string.js index 799f8d1585859c..aefdf24600fe50 100644 --- a/test/parallel/test-runner-skip-empty-string.js +++ b/test/parallel/test-runner-skip-empty-string.js @@ -1,15 +1,6 @@ 'use strict'; -require('../common'); +const common = require('../common'); const { test } = require('node:test'); -const assert = require('assert'); -let ran = false; - -test('skip option empty string should not skip', { skip: '' }, () => { - ran = true; -}); - -process.on('exit', () => { - assert.ok(ran); -}); +test('skip option empty string should not skip', { skip: '' }, common.mustCall()); \ No newline at end of file From 56ab67ad615952598bec6072e86c8e8c72b09db1 Mon Sep 17 00:00:00 2001 From: Vaishnavi J K Date: Sun, 22 Mar 2026 01:11:11 +0530 Subject: [PATCH 4/6] test: add newline at end of file --- test/parallel/test-runner-skip-empty-string.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-runner-skip-empty-string.js b/test/parallel/test-runner-skip-empty-string.js index aefdf24600fe50..03352ce9a475e8 100644 --- a/test/parallel/test-runner-skip-empty-string.js +++ b/test/parallel/test-runner-skip-empty-string.js @@ -3,4 +3,4 @@ const common = require('../common'); const { test } = require('node:test'); -test('skip option empty string should not skip', { skip: '' }, common.mustCall()); \ No newline at end of file +test('skip option empty string should not skip', { skip: '' }, common.mustCall()); From 6014f0aa9a22aa8bb16d07a5f327e1137ad5aba8 Mon Sep 17 00:00:00 2001 From: Vaishnavi J K Date: Fri, 27 Mar 2026 14:06:06 +0530 Subject: [PATCH 5/6] style: use !!skip instead of Boolean(skip) --- lib/internal/test_runner/test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/test_runner/test.js b/lib/internal/test_runner/test.js index 9c25d48639d37c..0d650ec2a06e0f 100644 --- a/lib/internal/test_runner/test.js +++ b/lib/internal/test_runner/test.js @@ -150,7 +150,7 @@ function stopTest(timeout, signal) { disposeFunction = () => { abortListener[SymbolDispose](); - clearTimeout(timer); + timer[SymbolDispose](); }; } @@ -680,7 +680,7 @@ class Test extends AsyncResource { this.expectedAssertions = plan; this.cancelled = false; this.expectFailure = parseExpectFailure(expectFailure) || this.parent?.expectFailure; - this.skipped = Boolean(skip); + this.skipped = !!skip; this.isTodo = (todo !== undefined && todo !== false) || this.parent?.isTodo; this.startTime = null; this.endTime = null; From 814ea72b00cb3f9f1610676036dadbee48c79962 Mon Sep 17 00:00:00 2001 From: Vaishnavi J K Date: Sat, 28 Mar 2026 12:10:27 +0530 Subject: [PATCH 6/6] style: remove unused Boolean from primordials --- lib/internal/test_runner/test.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/internal/test_runner/test.js b/lib/internal/test_runner/test.js index 0d650ec2a06e0f..663d314a016a68 100644 --- a/lib/internal/test_runner/test.js +++ b/lib/internal/test_runner/test.js @@ -9,7 +9,6 @@ const { ArrayPrototypeSplice, ArrayPrototypeUnshift, ArrayPrototypeUnshiftApply, - Boolean, Error, FunctionPrototype, MathMax,