-
-
Notifications
You must be signed in to change notification settings - Fork 34.3k
Open
Description
Version
v24.2.0
Platform
Linux fd829b446dea 6.6.96-0-virt #1-Alpine SMP PREEMPT_DYNAMIC 2025-07-07 15:18:25 aarch64 GNU/Linux
Subsystem
modules/esm/utils
What steps will reproduce the bug?
Create a file test/00.internal.Link.js with:
/* eslint-disable sort-keys */
import {describe, it} from "mocha";
import {expect} from "chai";
import isString from "is-string";
import Link, {BROKEN_REASON, EXCLUDED_REASON, HTML_ATTR_NAME, HTML_ATTRS, HTML_BASE_HREF, HTML_INDEX, HTML_LOCATION, HTML_OFFSET_INDEX, HTML_SELECTOR, HTML_TAG, HTML_TAG_NAME, HTML_TEXT, HTTP_RESPONSE, HTTP_RESPONSE_WAS_CACHED, IS_BROKEN, IS_INTERNAL, IS_SAME_PAGE, ORIGINAL_URL, REBASED_BASE_URL, REBASED_URL, REDIRECTED_URL, RESOLVED_BASE_URL, RESOLVED_URL, WAS_EXCLUDED} from "../lib/internal/Link.js";
import {simplifyLink} from "./helpers/index.js";
import URL_TESTS from "./fixtures-json/Link.json" with { type: "json" };Before doing that, create it without with { type: "json" } to get:
Exception during run: TypeError [ERR_IMPORT_ATTRIBUTE_MISSING]: Module "file:///broken-link-checker/test/fixtures-json/Link.json" needs an import attribute of "type: json"
at validateAttributes (node:internal/modules/esm/assert:88:15)
at defaultLoad (node:internal/modules/esm/load:129:3)
at async ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:592:32) {
code: 'ERR_IMPORT_ATTRIBUTE_MISSING'
}But when adding with { type: "json" }, the result is:
Exception during run: SyntaxError[ @/broken-link-checker/test/00.internal.Link.js ]: Unexpected strict mode reserved word
at compileSourceTextModule (node:internal/modules/esm/utils:351:16)
at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:107:18)
at #translate (node:internal/modules/esm/loader:546:12)
at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:593:27)Note that in both cases, there is no line number/offset
How often does it reproduce? Is there a required condition?
100%
What is the expected behavior? Why is that the expected behavior?
All other files in the stack trace include a line number and offset. Ideally the faulting line should too (it's the one that humans are most interested in).
What do you see instead?
Exception during run: SyntaxError[ @/broken-link-checker/test/00.internal.Link.js ]: Unexpected strict mode reserved word
Additional information
docker run -it --entrypoint bash nodegit init broken-link-checker
cd broken-link-checker
git remote add origin https://github.com/jsoref/broken-link-checker/
git fetch origin 1a0bdd1e0b2159f939af4ec24aa8e0bd2382311f
git checkout FETCH_HEAD
npm install
npm run testMetadata
Metadata
Assignees
Labels
No labels