Skip to content

Honor ignoreCallsFromThisFile() for ES modules with a quibble query - #130

Merged
rosston merged 2 commits into
mainfrom
fix-ignore-calls-quibble-query-99
Oct 12, 2026
Merged

rosston merged 2 commits into
mainfrom
fix-ignore-calls-quibble-query-99

Conversation

@rosston

@rosston rosston commented Oct 12, 2026

Copy link
Copy Markdown
Member

Fixes #99

quibble.esm() and quibble.esmImportWithPath() compared raw ESM stack-frame URLs against the ignore list. A wrapper imported while a mock existed has a ?__quibble=N URL, so it was never skipped and specifiers resolved from the wrapper's directory instead of its caller's.

Drop the query and hash from file: stack-frame URLs, as fileURLToPath() already does for path-mode callers. Also let ignoreCallsFromThisFile() take a file: URL such as import.meta.url, which the first change would otherwise stop matching.

Fixes #99

quibble.esm() and quibble.esmImportWithPath() compared raw ESM stack-frame
URLs against the ignore list. A wrapper imported while a mock existed has
a `?__quibble=N` URL, so it was never skipped and specifiers resolved from
the wrapper's directory instead of its caller's.

Drop the query and hash from file: stack-frame URLs, as fileURLToPath()
already does for path-mode callers. Also let ignoreCallsFromThisFile()
take a file: URL such as import.meta.url, which the first change would
otherwise stop matching.
@rosston rosston self-assigned this Oct 12, 2026
Before Node 22, a module's import.meta.url and stack frames never carry
quibble's `?__quibble=N` query, so the #99 bug can't happen there and the
tests' tag check failed on Node 20 in CI. Keep the check on Node 22+,
where it guards against the tests silently passing, and run the rest of
each test everywhere.

Also say in the changelog when the query is there: Node 22+ for a module
imported while a mock existed, or a loader that adds one.
@rosston

rosston commented Oct 12, 2026

Copy link
Copy Markdown
Member Author

testdouble.js integration failures are here for the same reason as #129 (comment). They'll be fixed when testdouble.js is upgraded to the new quibble.

@rosston
rosston marked this pull request as ready for review October 12, 2026 15:37
@rosston
rosston merged commit f8be11c into main Oct 12, 2026
12 of 18 checks passed
@rosston
rosston deleted the fix-ignore-calls-quibble-query-99 branch October 12, 2026 15:37
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.

Ignore ignoreCallsFromThisFile does not work properly v0.7.0

1 participant