-
Notifications
You must be signed in to change notification settings - Fork 19
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
Mocking a file with a hashbang using the import
key fails
#215
Comments
I think the issue is that hashbangs have to be at the start of the file (MDN):
|
Very similar issue without hashbang. foo.js export default 1; cli.js import someConstant from "./foo.js";
console.log(someConstant); 1.js import esmock from "esmock";
await esmock("./cli.js", {
"./foo.js": "bar",
});
|
I think you are correct :) thanks for finding this. I should have time this evening or tomorrow to look at PRs or try to resolve it myself |
related nodejs/node#35518 |
The ci error went away when node 18.16 was pinned. The error occurs on the latest 18.17 A new ticket is created at the node repo here let's see what they say nodejs/node#48948 |
closing with this #217 feel free to reopen for any reason |
Given some file
cli.js
:Trying to mock this with the
import
key fails with the erroresmock
call:The text was updated successfully, but these errors were encountered: