Run tests on Node.js 19 (#13682)

This commit is contained in:
fisker Cheung authored and GitHub committed 2022-10-20 09:12:39 +08:00
1 parent cac9222e5e
commit 9413e05a8b
4 files changed
+28 -26

No files matched your search

+6 -5
View File
@@ -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 }}
+5
View File
@@ -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"
@@ -1,16 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`cosmiconfig Invalid json file 1`] = `
"JSON Error in <cwd>/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 |
"
`;
+17 -5
View File
@@ -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 |
`);
}
});
});