Skip to content

Follow test objects built by functions, list refused declarations, and match the runners' state precedence - #34

Merged
Huldoser merged 1 commit into
mainfrom
scan-fixes
Oct 15, 2026
Merged

Huldoser merged 1 commit into
mainfrom
scan-fixes

Conversation

@Huldoser

Copy link
Copy Markdown
Owner

What changed

Three fixes from the Oct 14 bug hunt, one changeset each:

  • Fixtures files that build their test object with a function. A fixtures file that builds its test with a function, written there or imported, as in export const test = defineDeskTest('equities'), is followed. MSW's test files import such a test: in its 117 files the scan finds 968 tests instead of 864. A call that can't be followed is named in the unresolved-test-import error. Before, nothing was reported when the fixtures file didn't import the framework.

  • Refused calls written like declarations. A call the runner refuses that is written like a declaration is listed as a plain test or describe, without the part that fails. Examples are describe.sequential('title', fn) in Vitest 5, options passed third from Vitest 4, and test.only.skip('title', fn). Its tests are notLoaded like the rest of the file, instead of missing. Four goldens gain the refused test.

  • State precedence. Each rule below was checked against Vitest 5.0.4 running generated files:

    • a test's own options win over its chain, so test.skip('title', { skip: false }, fn) runs, but the chain still sets the mode;
    • a describe passes its skip option down to everything registered in it, where it wins over todo, also through helper functions and when the describe's own .only beats its skip;
    • an unconditional fixme, skip or todo set while the file loads wins over a skip in a test or hook body.

    On 300 generated files, disagreements with Vitest go from 122 to 73.

A code review before merging found and fixed 14 issues, among them a slower scan and a file wrongly marked notLoaded. The comparison corpus shows no differences from main.

Checklist

  • Tests cover the change, and npm run coverage reports 100%.
  • The docs describe the change: the guide or reference pages, the README, or the TSDoc of exported functions.
  • No docs change is needed.
  • A changeset describes the change for users (npm run changeset), or the change does not affect them.

…d match the runners' state precedence

A fixtures file that builds its test object with a function, as in
`export const test = defineDeskTest('equities')`, is followed, in the file
or imported. A call that can't be followed is named in the
unresolved-test-import error.

A call the runner refuses that is written like a declaration, as
`describe.sequential('title', fn)` in Vitest 5, is listed as a plain test or
describe, so its tests are notLoaded instead of missing.

States follow Vitest's precedence, checked against Vitest 5.0.4: a test's
own options win over its chain, except for the mode; a describe passes its
skip option down to everything registered in it, also through helper
functions; and a skip, fixme or todo set while the file loads wins over a
skip in a test or hook body.
@Huldoser
Huldoser enabled auto-merge (squash) October 15, 2026 12:49
@Huldoser
Huldoser merged commit 0f96258 into main Oct 15, 2026
27 checks passed
@Huldoser
Huldoser deleted the scan-fixes branch October 15, 2026 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant