Skip to content

Report imported test objects called through unknown members or with a timeout - #30

Merged
Huldoser merged 1 commit into
mainfrom
report-unfollowed-calls
Oct 14, 2026
Merged

Huldoser merged 1 commit into
mainfrom
report-unfollowed-calls

Conversation

@Huldoser

Copy link
Copy Markdown
Owner

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:

  • A call through a member the scan doesn't know. Effect calls it.effect('…', fn) on the it that @effect/vitest extends, 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 with unresolved-test-import when it can't be.
  • A timeout after the body. trigger.dev calls postgresTest('…', fn, 60_000), which Vitest accepts. Such a call now counts as shaped like a test.

Following @effect/vitest turned up a third problem: its own export const it = internal.it was read as Vitest's it, from export * from 'vitest' in the same module. A module's own export now wins over export *, as in JavaScript.

On the corpus, the Sentry unit tests get 3 more unresolved-test-import errors, for files that use only it.effect, and the real-projects page says 24 instead of 21. Nothing else changes.

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.

… 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.
@Huldoser
Huldoser merged commit 968e2bc into main Oct 14, 2026
27 checks passed
@Huldoser
Huldoser deleted the report-unfollowed-calls branch October 14, 2026 14:55
@Huldoser Huldoser mentioned this pull request Oct 14, 2026
2 of 4 tasks
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