Skip to content
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

Fails with Node.js ≥ 16.12.0 due to loader hook API change #6

Closed
andersk opened this issue Dec 29, 2021 · 1 comment
Closed

Fails with Node.js ≥ 16.12.0 due to loader hook API change #6

andersk opened this issue Dec 29, 2021 · 1 comment

Comments

@andersk
Copy link

andersk commented Dec 29, 2021

This hook worked with Node 16.11.1 but fails with ≥ 16.12.0. It now raises (node:40) DeprecationWarning: Obsolete loader hook(s) supplied and will be ignored: transformSource, and fails to collect any coverage data. This is due to an incompatible change in the ESM loader hook API. Incompatible changes to this experimental API were not unexpected, of course, but it’s worth having an issue noting that this has now occurred and the package is no longer functional.

Minimal test case:

package.json

{
  "dependencies": {
    "@istanbuljs/esm-loader-hook": "^0.1.2",
    "nyc": "^15.1.0"
  },
  "type": "module"
}

test.js

import "./module.js";

module.js

console.log("Hello, world!");
export {};
$ npx nyc node --experimental-loader=@istanbuljs/esm-loader-hook test.js
(node:2394052) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2394052) DeprecationWarning: Obsolete loader hook(s) supplied and will be ignored: transformSource
Hello, world!
----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------|---------|----------|---------|---------|-------------------
All files |       0 |        0 |       0 |       0 |                   
----------|---------|----------|---------|---------|-------------------
@vassudanagunta
Copy link

I've confirmed this. I'll update the StackOverflow setup instructions12 for this once I know what the plan is going forward.

Footnotes

  1. https://stackoverflow.com/questions/62509699/nyc-mocha-es6-modules

  2. https://stackoverflow.com/questions/67913176/how-to-implement-istanbul-coverage-with-selenium-and-mocha/68095739?noredirect=1#comment124669336_68095739

coreyfarrell added a commit that referenced this issue Jul 15, 2022
BREAKING CHANGE: Node.js 16.12.0 is required

Fixes #6
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

No branches or pull requests

2 participants