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
{{ message }}
Repository navigation
bug: Runtime.executionContextDestroyed event does not fire for .mjs files #17336
Following up from #16531, for CommonJS modules we are now able to collect detailed coverage information regardless of how a process exits. This is facilitated by:
starting a process with --inspect-brk.
running startPreciseCoverage.
waiting for the event Runtime.executionContextDestroyed (this will fire when the isolate terminates execution).
ESM Failing
Using the same approach outlined above for .mjs files, the Runtime.executionContextDestroyed event does not appear to fire -- I see the following output in a hung terminal:
Debugger listening on ws://127.0.0.1:53080/ce9cf16c-dce4-42b1-bf4f-98b523c9f36e
For help see https://nodejs.org/en/docs/inspector
Debugger attached.
(node:93632) ExperimentalWarning: The ESM module loader is experimental.
Waiting for the debugger to disconnect...
Reproducing this Issue
I've been keeping the module c8 up to date, as we march towards a native test coverage solution. To see the bug in action, clone the above repo and run:
And the application will exit as expected (c.mjs isn't using import syntax, it seems to simply be the new importer that conflicts with the Runtime.executionContextDestroyed event).
This bug isn't actually in the ESM loading system but in c8, since the .mjs file actually goes through the regular CJS loading process due to a lack of --experimental-modules. I've filed a PR that fixes this issue in c8 at bcoe/c8#6.
However, that PR doesn't make ESM just start working in c8 because of a separate bug in Node.js, which I've filed at #17340.
Activity
TimothyGu commentedon Nov 27, 2017
This bug isn't actually in the ESM loading system but in c8, since the
.mjsfile actually goes through the regular CJS loading process due to a lack of--experimental-modules. I've filed a PR that fixes this issue in c8 at bcoe/c8#6.However, that PR doesn't make ESM just start working in c8 because of a separate bug in Node.js, which I've filed at #17340.
I will close this issue.