TestContext.runOnly method | Node.js node:test module | Bun
BuildDocsReferenceGuidesBlogDiscord/
node:test/
default/
TestContext/
runOnlyMrunOnly
Search the reference...
/
BuildDocsReferenceGuidesBlogDiscord/
node:test/
default/
TestContext/
runOnlyMrunOnly
method
test.default.TestContext.runOnly {
// 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 }),
]);
});
```" data-algolia-static="false" data-algolia-merged="false" data-type="Method">
runOnly(shouldRunOnlyTests: boolean): void;
If 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 }),
]);
});
@param shouldRunOnlyTests
Whether or not to run only tests.
Resources
ReferenceDocsGuidesDiscordMerch StoreGitHubBlog Toolkit
RuntimePackage managerTest runnerBundlerPackage runnerProject
Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San Francisco
We're hiring →