Repository navigation
Follow test objects built by functions, list refused declarations, and match the runners' state precedence - #34
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
testwith a function, written there or imported, as inexport const test = defineDeskTest('equities'), is followed. MSW's test files import such atest: in its 117 files the scan finds 968 tests instead of 864. A call that can't be followed is named in theunresolved-test-importerror. 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, andtest.only.skip('title', fn). Its tests arenotLoadedlike 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:
test.skip('title', { skip: false }, fn)runs, but the chain still sets the mode;skipoption down to everything registered in it, where it wins over todo, also through helper functions and when the describe's own.onlybeats its skip;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 frommain.Checklist
npm run coveragereports 100%.npm run changeset), or the change does not affect them.