Title: node --test --watch hangs on invalid import syntax · Issue #62021 · nodejs/node · GitHub
Open Graph Title: node --test --watch hangs on invalid import syntax · Issue #62021 · nodejs/node
X Title: node --test --watch hangs on invalid import syntax · Issue #62021 · nodejs/node
Description: Version 25 Platform Darwin Subsystem No response What steps will reproduce the bug? The test file // test.mjs import Run node --test --watch Any change touch test.mjs How often does it reproduce? Is there a required condition? always Wha...
Open Graph Description: Version 25 Platform Darwin Subsystem No response What steps will reproduce the bug? The test file // test.mjs import Run node --test --watch Any change touch test.mjs How often does it reproduce? I...
X Description: Version 25 Platform Darwin Subsystem No response What steps will reproduce the bug? The test file // test.mjs import Run node --test --watch Any change touch test.mjs How often does it reproduce? I...
Opengraph URL: https://github.com/nodejs/node/issues/62021
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"node --test --watch hangs on invalid import syntax","articleBody":"### Version\n\n25\n\n### Platform\n\n```text\nDarwin\n```\n\n### Subsystem\n\n_No response_\n\n### What steps will reproduce the bug?\n\n1. The test file\n```js\n// test.mjs\nimport\n```\n\n2. Run\n```sh\nnode --test --watch\n```\n\n3. Any change\n```sh\ntouch test.mjs\n```\n\n### How often does it reproduce? Is there a required condition?\n\nalways\n\n### What is the expected behavior? Why is that the expected behavior?\n\nWhat: Don't hang.\nWhy: Because it should watch.\n\n### What do you see instead?\n\nHangs after the summary until `Ctrl+C` and prints one last summary after that.\nSo for the minimal example given before, that's one error message and two summaries in total.\n\nThe error is similar to this:\n\n```txt\nSyntaxError: Unexpected end of input\n at compileSourceTextModule (node:internal/modules/esm/utils:305:16)\n at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:111:18)\n at #translate (node:internal/modules/esm/loader:467:20)\n at afterLoad (node:internal/modules/esm/loader:523:29)\n at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:528:12)\n at #getOrCreateModuleJobAfterResolve (node:internal/modules/esm/loader:565:36)\n at afterResolve (node:internal/modules/esm/loader:618:52)\n at ModuleLoader.getOrCreateModuleJob (node:internal/modules/esm/loader:624:12)\n at onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:643:32)\n at TracingChannel.tracePromise (node:diagnostics_channel:350:14)\n```\n\n### Additional information\n\nIdea: `--test` and `--watch` should have what `--check` does as an internal per file and change prerequisite.","author":{"url":"https://github.com/valler","@type":"Person","name":"valler"},"datePublished":"2026-02-27T12:12:46.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/62021/node/issues/62021"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8dd0399c-0873-6e45-0584-a1f88a3881bc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BE76:3910E6:9AD77:D976E:6A4D1034 |
| html-safe-nonce | c62a54cdafb436f05f75e90d019fe993cc879f06ca019fa5cbebb3e477a1e1f0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRTc2OjM5MTBFNjo5QUQ3NzpEOTc2RTo2QTREMTAzNCIsInZpc2l0b3JfaWQiOiI5MDUwOTA0MzI0MDM3NDgwNTAxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | dafdcdee840d948ef51f583b2858711d0f4be9d55faccb40561b690ee07577b0 |
| hovercard-subject-tag | issue:4000740499 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/62021/issue_layout |
| twitter:image | https://opengraph.githubassets.com/77c1b75599b0b05eaf69f402e84b47e67aa09158516cb188aa5c7623299223a4/nodejs/node/issues/62021 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/77c1b75599b0b05eaf69f402e84b47e67aa09158516cb188aa5c7623299223a4/nodejs/node/issues/62021 |
| og:image:alt | Version 25 Platform Darwin Subsystem No response What steps will reproduce the bug? The test file // test.mjs import Run node --test --watch Any change touch test.mjs How often does it reproduce? I... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | valler |
| hostname | github.com |
| expected-hostname | github.com |
| None | bcb4661e6fb4fe8b394c51ea02ccdb2236d40dc59afc75a3bbba50bf6517134c |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | fb70bd3c4b2bec429781b65419e912c66e2d5581 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width