TESTS_NO_ONLY

Requires that focused tests (i.e. it.only()) are unfocused.
Table of Contents

Conformance is available on Enterprise plans

Focusing tests can help to write and debug test suites, but focused tests should be unfocused before committing changes.

This rule disallows focused tests so that they can't be committed without an allowlist entry.

src/button/button.test.ts
describe('button', () => {
  it.only('should render', () => {
    // ...
  });
});

Note that the following patterns (and variants of these patterns) will be reported as errors by this test. These should cover popular test frameworks and runners, including:

// Most test frameworks and runners
describe.only(/* ... */);
it.concurrent.only(/* ... */);
test.only.each([])(/* ... */);
// Jest - supported in addition to the above
fdescribe(/* ... */);
fit.each([])(/* ... */);
ftest(/* ... */);

This error will be resolved when debugging is complete and the test has been unfocused.

The default pattern matches the default patterns for Jest and Vitest, however you can provide your own patterns through the paths property.

The default configuration is:

conformance.config.jsonc
{
  "configuration": [
    "testPatterns": ["**/unit-tests/**/*.{js,jsx}"]
  ]
}
Last updated on July 23, 2024