Repository navigation
Report imported test objects called through unknown members or with a timeout - #30
Merged
Merged
Conversation
… timeout
A call through an imported name that reads like a test function, with a title and a body, is followed and reported when it can't be, also through a member the scan doesn't know, as in it.effect('title', fn), and with a timeout after the body, as in test('title', fn, 60_000). Such tests were missing with no diagnostic.
A module's own export now wins over the same name passed on by export *, as in JavaScript, so export const it = ... next to export * from 'vitest' is not read as Vitest's it.
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
Comparing the scan with Vitest's own parser on 40 open-source projects found tests missing with no diagnostic in two cases, both through names imported from a module the scan follows:
it.effect('…', fn)on theitthat@effect/vitestextends, and 4,039 tests in its own repository were missing without a word. A call with a title and a body through a name that reads like a test function is now followed, and reported withunresolved-test-importwhen it can't be.postgresTest('…', fn, 60_000), which Vitest accepts. Such a call now counts as shaped like a test.Following
@effect/vitestturned up a third problem: its ownexport const it = internal.itwas read as Vitest'sit, fromexport * from 'vitest'in the same module. A module's own export now wins overexport *, as in JavaScript.On the corpus, the Sentry unit tests get 3 more
unresolved-test-importerrors, for files that use onlyit.effect, and the real-projects page says 24 instead of 21. Nothing else changes.Checklist
npm run coveragereports 100%.npm run changeset), or the change does not affect them.