You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The gist of the gist is that a function like the following which calls import.meta.resolve will never return when called after being loaded with t.mockImport. In the index.js file, the console.error(resolved) will never get called, and thus the test will never finish.
importtfrom'tap't.test('test',asynct=>{const{ index }=awaitt.mockImport('./index.js')console.error('mock import')index()console.error('call import')t.ok(true)})
Environment
# npm ls tap
tap-import-meta-resolve@1.0.0 /Users/lukekarrys/Desktop/scratch/tap-import-meta-resolve
└── tap@21.0.1
# npx tap versions
tap: 21.0.1
"@tapjs/config": 5.0.0
"@tapjs/core": 4.0.0
"@tapjs/run": 4.0.1
"@tapjs/stack": 4.0.0
"@tapjs/test": 4.0.0
tap-parser: 18.0.0
tap-yaml: 4.0.0
tcompare: 9.0.0
plugins:
"@tapjs/after": 3.0.0
"@tapjs/after-each": 4.0.0
"@tapjs/asserts": 4.0.0
"@tapjs/before": 4.0.0
"@tapjs/before-each": 4.0.0
"@tapjs/chdir": 3.0.0
"@tapjs/filter": 4.0.0
"@tapjs/fixture": 4.0.0
"@tapjs/intercept": 4.0.0
"@tapjs/mock": 4.0.0
"@tapjs/node-serialize": 4.0.0
"@tapjs/snapshot": 4.0.0
"@tapjs/spawn": 4.0.0
"@tapjs/stdin": 4.0.0
"@tapjs/typescript": 3.0.0
"@tapjs/worker": 4.0.0
# npx tap config list# vim: set filetype=yaml :
browser: true
color: true
coverage-report:
- text
exclude:
- "**/@(fixture*(s)|dist)/**"
include:
- "**/@(test?(s)|__test?(s)__)/**/*.@(js|cjs|mjs|tap|cts|jsx|mts|ts|tsx)"
- "**/*.@(test?(s)|spec).@(js|cjs|mjs|tap|cts|jsx|mts|ts|tsx)"
- "**/test?(s).@(js|cjs|mjs|tap|cts|jsx|mts|ts|tsx)"
jobs: 9
reporter: base
snapshot-clean-cwd: true
timeout: 30
# npx tap plugin list
@tapjs/after
@tapjs/after-each
@tapjs/asserts
@tapjs/before
@tapjs/before-each
@tapjs/chdir
@tapjs/filter
@tapjs/fixture
@tapjs/intercept
@tapjs/mock
@tapjs/node-serialize
@tapjs/snapshot
@tapjs/spawn
@tapjs/stdin
@tapjs/typescript
@tapjs/worker
# posix:
Darwin pieholden.local 24.0.0 Darwin Kernel Version 24.0.0: Tue Sep 24 23:37:25 PDT 2024; root:xnu-11215.1.12~1/RELEASE_ARM64_T6030 arm64 arm Darwin
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Is there an existing issue for this?
Have you read the
CONTRIBUTING
guide on posting bugs, andCODE_OF_CONDUCT
?This issue exists in the latest tap version
Description
Calling
import.meta.resolve()
from inside a module that is loaded witht.mockImport
will never return.Reproduction
Repro gist: https://gist.github.com/lukekarrys/8ab4ab047b363d98ed825eb560a02c9b
The gist of the gist is that a function like the following which calls
import.meta.resolve
will never return when called after being loaded witht.mockImport
. In theindex.js
file, theconsole.error(resolved)
will never get called, and thus the test will never finish.index.js
test.js
Environment
The text was updated successfully, but these errors were encountered: