From 960e620f1a12ceabc2615d4e1cdbe98627ef6816 Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Wed, 8 May 2024 16:50:34 +0300 Subject: [PATCH] test: fix (#239) --- test/loader.test.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/loader.test.js b/test/loader.test.js index e7bf43d..919d3dc 100644 --- a/test/loader.test.js +++ b/test/loader.test.js @@ -264,13 +264,15 @@ describe("source-map-loader", () => { dependencies.forEach((fixture) => { expect(deps.has(fixture)).toBe(true); }); + expect(codeFromBundle.map).toBeUndefined(); expect(codeFromBundle.code).toMatchSnapshot("code"); - if ( - process.version.startsWith("v20") || - process.version.startsWith("v21") - ) { + const match = process.version.match( + /^v(\d{1,2})\.(\d{1,2})\.(\d{1,2})(?:-([0-9A-Za-z-.]+))?(?:\+([0-9A-Za-z-.]+))?$/, + ); + + if (parseInt(match[1], 10) >= 20) { expect(getWarnings(stats)[0]).toContain( `SyntaxError: Unexpected non-whitespace character after JSON at position 102`, );