From 0684d04cda1f1c8e9ea2dd0e46089d8094a86887 Mon Sep 17 00:00:00 2001 From: pulkit-30 Date: Wed, 10 Jan 2024 22:49:12 +0530 Subject: [PATCH] test_runner: pass noop fn when test marked as todo --- lib/internal/test_runner/test.js | 2 +- .../test-runner/output/describe_it.snapshot | 28 ++----------------- 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/lib/internal/test_runner/test.js b/lib/internal/test_runner/test.js index e38b1a67c09660..5da20bc8479939 100644 --- a/lib/internal/test_runner/test.js +++ b/lib/internal/test_runner/test.js @@ -296,7 +296,7 @@ class Test extends AsyncResource { skip = '\'only\' option not set'; } - if (skip) { + if (skip || todo) { fn = noop; } diff --git a/test/fixtures/test-runner/output/describe_it.snapshot b/test/fixtures/test-runner/output/describe_it.snapshot index 1d4f7853ead0d1..a1ad0f9172d482 100644 --- a/test/fixtures/test-runner/output/describe_it.snapshot +++ b/test/fixtures/test-runner/output/describe_it.snapshot @@ -10,38 +10,14 @@ ok 2 - sync pass todo with message # TODO this is a passing todo duration_ms: * ... # Subtest: sync todo -not ok 3 - sync todo # TODO +ok 3 - sync todo # TODO --- duration_ms: * - location: '/test/fixtures/test-runner/output/describe_it.js:(LINE):4' - failureType: 'testCodeFailure' - error: 'should not count as a failure' - code: 'ERR_TEST_FAILURE' - stack: |- - * - * - * - * - * - * - * ... # Subtest: sync todo with message -not ok 4 - sync todo with message # TODO this is a failing todo +ok 4 - sync todo with message # TODO this is a failing todo --- duration_ms: * - location: '/test/fixtures/test-runner/output/describe_it.js:(LINE):1' - failureType: 'testCodeFailure' - error: 'should not count as a failure' - code: 'ERR_TEST_FAILURE' - stack: |- - * - * - * - * - * - * - * ... # Subtest: sync skip pass ok 5 - sync skip pass # SKIP