π only
The .only
helper 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.
This method can be changed according to users' suggestions and needs. Major changes in this method won't be considered breaking changes while it's in experimental stage.
History
Version | Changes |
---|---|
v2.7.0 | only modifier to describe , it and test methods. |
Usageβ
To enable the .only
helper, you must to pass one of the following flags to enable it selectively:
--only
β
Enables the .only
helper for describe
, it
and test
methods.
- β
describe.only
- β
it.only
- β
test.only
- βοΈ
describe
(it will be skipped)- βοΈ
it
(it will be skipped)- βοΈ
test
(it will be skipped)
import { describe, it, test } from 'poku';
describe.only(() => {
it.only(() => {
// ...
});
test.only(() => {
// ...
});
});
test.only(() => {
// ...
});
npx poku --only
note
describe
,it
andtest
methods without.only
will be skipped.
--only=describe
β
Enables the .only
helper for describe
method.
- β
describe.only
- β
it
- β
test
- βοΈ
describe
(it will be skipped)- β
it.only
(it forces a failure sinceit.only
is not enabled in--only=describe
)- β
test.only
(it forces a failure sincetest.only
is not enabled in--only=describe
)
import { describe, it, test } from 'poku';
describe.only(() => {
it(() => {
// ...
});
test(() => {
// ...
});
});
test(() => {
// ...
});
npx poku --only=describe
note
describe
methods without.only
will be skipped.it
andtest
methods without.only
will be executed normally, including outside the scope ofdescribe
(top-level).
--only=it
β
Alternative flag:
--only=test
Enables the .only
helper for it
and test
methods.
- β
it.only
- β
test.only
- β
describe
- βοΈ
it
(it will be skipped)- βοΈ
test
(it will be skipped)