Skip to content

Commit 7479611

Browse files
committed
Fix test on Node.js v26
1 parent da6f89e commit 7479611

4 files changed

Lines changed: 33 additions & 19 deletions

File tree

‎tests/integration/__tests__/__snapshots__/config-invalid.js.snap‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,3 @@ exports[`throw error with invalid config precedence option (configPrecedence) 1
8686
"write": [],
8787
}
8888
`;
89-
90-
exports[`throw error with invalid config target (directory) 1`] = `
91-
{
92-
"stderr": "[error] Invalid configuration:
93-
[error] Unable to read '<cli>/config/invalid/folder/.prettierrc': EISDIR: illegal operation on a directory, read",
94-
"stdout": "",
95-
"write": [],
96-
}
97-
`;

‎tests/integration/__tests__/__snapshots__/invalid-ignore.js.snap‎

Lines changed: 0 additions & 9 deletions
This file was deleted.

‎tests/integration/__tests__/config-invalid.js‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,22 @@ describe("throw error with invalid config target (directory)", () => {
3535
"folder/.prettierrc", // this is a directory
3636
]).test({
3737
status: "non-zero",
38+
stderr:
39+
/*
40+
On Node.js<26
41+
42+
```
43+
EISDIR: illegal operation on a directory, read
44+
```
45+
46+
On Node.js>=26
47+
```
48+
EISDIR: illegal operation on a directory, read '<cli>/config/invalid/folder/.prettierrc'
49+
```
50+
*/
51+
expect.stringContaining("EISDIR: illegal operation on a directory, read"),
52+
stdout: "",
53+
write: [],
3854
});
3955
});
4056

‎tests/integration/__tests__/invalid-ignore.js‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,22 @@ const { __dirname } = createEsmUtils(import.meta);
77
describe("throw error with invalid ignore", () => {
88
runCli("cli/invalid-ignore", ["something.js"]).test({
99
status: "non-zero",
10+
stderr:
11+
/*
12+
On Node.js<26
13+
14+
```
15+
EISDIR: illegal operation on a directory, read
16+
```
17+
18+
On Node.js>=26
19+
```
20+
EISDIR: illegal operation on a directory, read '...'
21+
```
22+
*/
23+
expect.stringContaining("EISDIR: illegal operation on a directory, read"),
24+
stdout: "",
25+
write: [],
1026
});
1127

1228
test("sync api", async () => {
@@ -17,6 +33,6 @@ describe("throw error with invalid ignore", () => {
1733
"../cli/invalid-ignore/.prettierignore",
1834
),
1935
}),
20-
).rejects.toThrow(/EISDIR: illegal operation on a directory/);
36+
).rejects.toThrow(/EISDIR: illegal operation on a directory, read/);
2137
});
2238
});

0 commit comments

Comments
 (0)