From e917a9a2e555d398c64b985fc933d44a42c958f0 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Fri, 21 Oct 2022 01:48:07 +0900 Subject: [PATCH] ci: add node v19 (#16443) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Node v19.0.0 has been released. https://nodejs.org/en/blog/release/v19.0.0/ This PR adds the v19 matrix and fixes the following tests failure when using v19.0.0. ```console % node -v v19.0.0 % npx mocha tests/lib/shared/runtime-info.js (snip) 1) RuntimeInfo environment() log and throw an error when checking for local ESLint version when returned output of command is malformed: AssertionError: expected [Function environment] to throw error including 'Unexpected token T in JSON at positio…' but got 'Unexpected token \'T\', "This is not …' + expected - actual -Unexpected token 'T', "This is not JSON" is not valid JSON +Unexpected token T in JSON at position 0 at Context. (tests/lib/shared/runtime-info.js:209:20) at process.processImmediate (node:internal/timers:471:21) 2) RuntimeInfo environment() log and throw an error when checking for global ESLint version when returned output of command is malformed: AssertionError: expected [Function environment] to throw error including 'Unexpected token T in JSON at positio…' but got 'Unexpected token \'T\', "This is not …' + expected - actual -Unexpected token 'T', "This is not JSON" is not valid JSON +Unexpected token T in JSON at position 0 at Context. (tests/lib/shared/runtime-info.js:217:20) at process.processImmediate (node:internal/timers:471:21) ``` This patch uses regexp to match both messages because the message has changed in v19.0.0. --- .github/workflows/ci.yml | 2 +- tests/lib/shared/runtime-info.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9401ec54924..adcd701ab20 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - node: [18.x, 17.x, 16.x, 14.x, 12.x, "12.22.0"] + node: [19.x, 18.x, 17.x, 16.x, 14.x, 12.x, "12.22.0"] include: - os: windows-latest node: "16.x" diff --git a/tests/lib/shared/runtime-info.js b/tests/lib/shared/runtime-info.js index efe57bb0baa..ac549c0d001 100644 --- a/tests/lib/shared/runtime-info.js +++ b/tests/lib/shared/runtime-info.js @@ -206,7 +206,7 @@ describe("RuntimeInfo", () => { spawnSyncStubArgs[2] = "This is not JSON"; setupSpawnSyncStubReturnVals(spawnSyncStub, spawnSyncStubArgs); - assert.throws(RuntimeInfo.environment, "Unexpected token T in JSON at position 0"); + assert.throws(RuntimeInfo.environment, /^Unexpected token .*T.* JSON/u); assert.strictEqual(logErrorStub.args[0][0], "Error finding eslint version running the command `npm ls --depth=0 --json eslint`"); }); @@ -214,7 +214,7 @@ describe("RuntimeInfo", () => { spawnSyncStubArgs[4] = "This is not JSON"; setupSpawnSyncStubReturnVals(spawnSyncStub, spawnSyncStubArgs); - assert.throws(RuntimeInfo.environment, "Unexpected token T in JSON at position 0"); + assert.throws(RuntimeInfo.environment, /^Unexpected token .*T.* JSON/u); assert.strictEqual(logErrorStub.args[0][0], "Error finding eslint version running the command `npm ls --depth=0 --json eslint -g`"); }); });