node/test/message/test_runner_test_name_pattern_with_only.js
cjihrig 87170c3f92
test_runner: add --test-name-pattern CLI flag
This commit adds support for running tests that match a
regular expression.

Fixes: https://github.com/nodejs/node/issues/42984
2022-10-04 09:15:02 -04:00

14 lines
523 B
JavaScript

// Flags: --no-warnings --test-only --test-name-pattern=enabled
'use strict';
const common = require('../common');
const { test } = require('node:test');
test('enabled and only', { only: true }, common.mustCall(async (t) => {
await t.test('enabled', common.mustCall());
await t.test('disabled', common.mustNotCall());
}));
test('enabled but not only', common.mustNotCall());
test('only does not match pattern', { only: true }, common.mustNotCall());
test('not only and does not match pattern', common.mustNotCall());