method TestContext.prototype.runOnly
#TestContext.prototype.runOnly(shouldRunOnlyTests: boolean): voidIf shouldRunOnlyTests is truthy, the test context will only run tests that
have the only option set. Otherwise, all tests are run. If Node.js was not
started with the --test-only command-line option, this function is a
no-op.
test('top level test', (t) => {
// The test context can be set to run subtests with the 'only' option.
t.runOnly(true);
return Promise.all([
t.test('this subtest is now skipped'),
t.test('this subtest is run', { only: true }),
]);
});
Parameters #
#shouldRunOnlyTests: boolean Whether or not to run only tests.
Return Type #
void