Skip to content

Commit 960e620

Browse files
test: fix (#239)
1 parent 3e0a779 commit 960e620

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/loader.test.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,15 @@ describe("source-map-loader", () => {
264264
dependencies.forEach((fixture) => {
265265
expect(deps.has(fixture)).toBe(true);
266266
});
267+
267268
expect(codeFromBundle.map).toBeUndefined();
268269
expect(codeFromBundle.code).toMatchSnapshot("code");
269270

270-
if (
271-
process.version.startsWith("v20") ||
272-
process.version.startsWith("v21")
273-
) {
271+
const match = process.version.match(
272+
/^v(\d{1,2})\.(\d{1,2})\.(\d{1,2})(?:-([0-9A-Za-z-.]+))?(?:\+([0-9A-Za-z-.]+))?$/,
273+
);
274+
275+
if (parseInt(match[1], 10) >= 20) {
274276
expect(getWarnings(stats)[0]).toContain(
275277
`SyntaxError: Unexpected non-whitespace character after JSON at position 102`,
276278
);

0 commit comments

Comments
 (0)