π only
The .only modifier enables selective execution of tests, allowing you to focus on specific describe, it, and/or test blocks by running only those marked with .only. See the usage to understand the different conditions and behaviors.
From 3.0.0-rc.1 onwards.
History
| Version | Changes | 
|---|---|
| v3.0.0 | only modifier to describe, it and test methods. | 
| v2.7.0 | only modifier to describe, it and test methods (experimental). | 
Usageβ
To enable the .only modifier, you must to pass the --only flag.
tip
You can pass the --only flag either using the test runner (Poku) or the runner you prefer, for example:
npx poku --only
npx tsx test/my-test.test.ts --only
npm test -- --only
node test/my-test.test.js --only
Common Examplesβ
import { describe, it, test } from 'poku';
describe.only(() => {
  // β
 Will be executed
  it(() => {
    // β
 Will be executed
  });
  test(() => {
    // β
 Will be executed
  });
});
describe(() => {
  // βοΈ Will be skipped
  it(() => {
    // βοΈ Will be skipped
  });
  test(() => {
    // βοΈ Will be skipped
  });
});
describe(() => {
  // β
 Will be executed
  it(() => {
    // βοΈ Will be skipped
  });
  it.only(() => {
    // β
 Will be executed
  });
  test(() => {
    // βοΈ Will be skipped
  });
});
npx poku --only
tip
- The 
.onlymodifier works exactly as its respectivedescribe,itandtestmethods (e.g., by runningbeforeEachandafterEachfor thetest.onlyorit.only). - It's not possible to run 
.onlymodifiers without--onlyflag. 
note
It's important to recall that Poku respects conventional JavaScript syntax in tests and doesn't change the order of the executions.