V8 Inspector is not available in --require in `node --test`
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 122k
- Forks
- 37.3k
- Ø Merge
- 4 T. 2 Std.
- Gemergte PRs (30 T.)
- 283
Beschreibung
Version
v20.3.0
Platform
Darwin MacBook-Pro-2.local 22.5.0 Darwin Kernel Version 22.5.0: Mon Apr 24 20:51:50 PDT 2023; root:xnu-8796.121.2~5/RELEASE_X86_64 x86_64
Subsystem
test_runner
What steps will reproduce the bug?
- Have a file start-inspect.js containing:
const inspector = require("node:inspector");
inspector.open();
- Have some other
file.test.js, which can be empty. - Run
NODE_OPTIONS="--require ./start-inspect.js" node --test ./hello.test.js
How often does it reproduce? Is there a required condition?
100%
What is the expected behavior? Why is that the expected behavior?
The inspector should open as usual, as if --test was not given in the CLI
What do you see instead?
$ NODE_OPTIONS="--require ./start-inspect.js" node --test ./hello.test.js
node:inspector:181
open(port, host);
^
This Environment was initialized without a V8::Inspector
(Use `node --trace-uncaught ...` to show where the exception was thrown)
Node.js v20.3.0
Additional information
This does not happen if --test is omitted from the command. This causes issues with the VS/Code debugger which uses this mechanism to initiate debugging. I think Jetbrains does the same thing, so Webstorm and friends probably have the same issue, though I have not tested it.
Also, if I try to open the inspector in the test file itself, it works fine, so it seems like there might be some initialization ordering that's different for --test.
Originally reported on https://github.com/microsoft/vscode-js-debug/issues/1727
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, den Fehler mit start-inspect.js, file.test.js, NODE_OPTIONS und node --test zu reproduzieren. Verfolge die Reihenfolge der Initialisierung rund um node:inspector, wenn --require ausgeführt wird, und vergleiche sie damit, den Inspector in der Testdatei zu öffnen. Füge eine Abdeckung für den Befehl hinzu und betrachte das Issue als erledigt, wenn der Inspector unter --test erfolgreich geöffnet wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, nodejs
- Bereich
- devtools, testing-qa
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Aktiv
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 55/100