Content-Length: 233086 | pFad | http://github.com/tapjs/tapjs/issues/1042

BE [BUG] import.meta.resolve in mocked import never returns · Issue #1042 · tapjs/tapjs · GitHub
Skip to content

[BUG] import.meta.resolve in mocked import never returns #1042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 tasks done
lukekarrys opened this issue Nov 7, 2024 · 0 comments
Open
3 tasks done

[BUG] import.meta.resolve in mocked import never returns #1042

lukekarrys opened this issue Nov 7, 2024 · 0 comments
Labels
bug something not go good

Comments

@lukekarrys
Copy link
Contributor

lukekarrys commented Nov 7, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Have you read the CONTRIBUTING guide on posting bugs, and CODE_OF_CONDUCT?

  • yes I read the things

This issue exists in the latest tap version

  • I am using the latest tap

Description

Calling import.meta.resolve() from inside a module that is loaded with t.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 with t.mockImport. In the index.js file, the console.error(resolved) will never get called, and thus the test will never finish.

index.js

export const index = () => {
  console.error('start index')
  const resolved = import.meta.resolve('abbrev')
  console.error(resolved)
}

test.js

import t from 'tap'

t.test('test', async t => {
  const { index } = await t.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
@lukekarrys lukekarrys added the bug something not go good label Nov 7, 2024
@lukekarrys lukekarrys changed the title [BUG] <title> [BUG] import.meta.resolve in mocked import never returns Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something not go good
Projects
None yet
Development

No branches or pull requests

1 participant








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/tapjs/tapjs/issues/1042

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy