From 0093fd3ca85b35b8bb2f4ff9d97082a71b23a124 Mon Sep 17 00:00:00 2001 From: Richie McColl Date: Tue, 21 Feb 2023 22:28:03 +0000 Subject: [PATCH] test_runner: add `describe.only` and `it.only` shorthands PR-URL: https://github.com/nodejs/node/pull/46604 Fixes: https://github.com/nodejs/node/issues/46562 Reviewed-By: Moshe Atlow --- doc/api/test.md | 18 ++++++ lib/internal/test_runner/harness.js | 2 +- test/message/test_runner_only_tests.js | 36 ++++++++++- test/message/test_runner_only_tests.out | 79 ++++++++++++++++++++++++- 4 files changed, 130 insertions(+), 5 deletions(-) diff --git a/doc/api/test.md b/doc/api/test.md index 4f8caffe12487a..dc5bbb2e199e3e 100644 --- a/doc/api/test.md +++ b/doc/api/test.md @@ -811,6 +811,15 @@ Shorthand for skipping a suite, same as [`describe([name], { skip: true }[, fn]) Shorthand for marking a suite as `TODO`, same as [`describe([name], { todo: true }[, fn])`][describe options]. +## `describe.only([name][, options][, fn])` + + + +Shorthand for marking a suite as `only`, same as +[`describe([name], { only: true }[, fn])`][describe options]. + ## `it([name][, options][, fn])` * `name` {string} The name of the test, which is displayed when reporting test @@ -835,6 +844,15 @@ same as [`it([name], { skip: true }[, fn])`][it options]. Shorthand for marking a test as `TODO`, same as [`it([name], { todo: true }[, fn])`][it options]. +## `it.only([name][, options][, fn])` + + + +Shorthand for marking a test as `only`, +same as [`it([name], { only: true }[, fn])`][it options]. + ## `before([fn][, options])`