diff --git a/.github/workflows/dev-test.yml b/.github/workflows/dev-test.yml index 8b4d05e11..ee0c5cc18 100644 --- a/.github/workflows/dev-test.yml +++ b/.github/workflows/dev-test.yml @@ -26,6 +26,7 @@ jobs: - "macos-latest" - "windows-latest" node: + - "19" - "18" - "16" include: @@ -35,11 +36,11 @@ jobs: ENABLE_CODE_COVERAGE: true FULL_TEST: true CHECK_TEST_PARSERS: true - # exclude: - # - os: "macos-latest" - # node: "16" - # - os: "windows-latest" - # node: "16" + exclude: + - os: "macos-latest" + node: "19" + - os: "windows-latest" + node: "19" env: ENABLE_CODE_COVERAGE: ${{ matrix.ENABLE_CODE_COVERAGE }} FULL_TEST: ${{ matrix.FULL_TEST }} diff --git a/.github/workflows/prod-test.yml b/.github/workflows/prod-test.yml index 9f88ace3b..2b291dffb 100644 --- a/.github/workflows/prod-test.yml +++ b/.github/workflows/prod-test.yml @@ -55,6 +55,7 @@ jobs: - "macos-latest" - "windows-latest" node: + - "19" - "18" - "16" - "14" @@ -63,6 +64,10 @@ jobs: node: "18" FULL_TEST: true exclude: + - os: "macos-latest" + node: "19" + - os: "windows-latest" + node: "19" - os: "macos-latest" node: "16" - os: "windows-latest" diff --git a/tests/integration/__tests__/__snapshots__/third-party.js.snap b/tests/integration/__tests__/__snapshots__/third-party.js.snap deleted file mode 100644 index d9088f3a7..000000000 --- a/tests/integration/__tests__/__snapshots__/third-party.js.snap +++ /dev/null @@ -1,16 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`cosmiconfig Invalid json file 1`] = ` -"JSON Error in /tests/integration/cli/config/invalid/broken-json/.prettierrc.json: - -> 1 | {a':} - | ^ - 2 | - -Unexpected token "a" (0x61) in JSON at position 1 while parsing "{a':}/n" - -> 1 | {a':} - | ^ - 2 | -" -`; diff --git a/tests/integration/__tests__/third-party.js b/tests/integration/__tests__/third-party.js index 0f31d9b4a..4bdda91ae 100644 --- a/tests/integration/__tests__/third-party.js +++ b/tests/integration/__tests__/third-party.js @@ -1,6 +1,8 @@ import path from "node:path"; import { pathToFileURL } from "node:url"; import createEsmUtils from "esm-utils"; +import outdent from "outdent"; +import stripAnsi from "strip-ansi"; import { thirdParty } from "../env.js"; import jestPathSerializer from "../path-serializer.js"; @@ -58,11 +60,21 @@ describe("cosmiconfig", () => { // #8815, please make sure this error contains code frame test("Invalid json file", async () => { - await expect( - cosmiconfig("prettier").search( - path.join(__dirname, "../cli/config/invalid/broken-json") - ) - ).rejects.toThrowErrorMatchingSnapshot(); + const result = cosmiconfig("prettier").search( + path.join(__dirname, "../cli/config/invalid/broken-json") + ); + await expect(result).rejects.toThrow(); + + try { + await result; + } catch (error) { + const message = stripAnsi(error.message); + expect(message).toContain(outdent` + > 1 | {a':} + | ^ + 2 | + `); + } }); });