Fix experimental-cli test (#17570)

This commit is contained in:
fisker Cheung authored and GitHub committed 2025-06-06 03:06:03 +08:00
1 parent b95cb103d5
commit f03061ae8d
2 files changed
+13 -12

No files matched your search

@@ -1,12 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
exports[`experimental cli 1`] = `
{
"stdout": "foo();",
}
`;
exports[`experimental cli '--check --no-parallel' 1`] = `
exports[`experimental cli --check --no-parallel 1`] = `
{
"status": 1,
"stderr": "[warn] test-1/should-format.js
@@ -17,7 +11,7 @@ exports[`experimental cli '--check --no-parallel' 1`] = `
}
`;
exports[`experimental cli '--check' 1`] = `
exports[`experimental cli --check 1`] = `
{
"status": 1,
"stderr": "[warn] test-0/should-format.js
@@ -28,7 +22,13 @@ exports[`experimental cli '--check' 1`] = `
}
`;
exports[`experimental cli '--write --no-parallel' 1`] = `
exports[`experimental cli --parser=meriyah 1`] = `
{
"stdout": "foo();",
}
`;
exports[`experimental cli --write --no-parallel 1`] = `
{
"status": 0,
"stderr": "",
@@ -37,7 +37,7 @@ exports[`experimental cli '--write --no-parallel' 1`] = `
}
`;
exports[`experimental cli '--write' 1`] = `
exports[`experimental cli --write 1`] = `
{
"status": 0,
"stderr": "",
@@ -6,6 +6,7 @@ const require = createRequire(import.meta.url);
function runExperimentalCli(args, options) {
return runCli("cli/experimental-cli", [...args, "--no-cache"], {
title: args.join(" "),
...options,
env: { ...options?.env, PRETTIER_EXPERIMENTAL_CLI: 1 },
});
@@ -59,7 +60,7 @@ describe("experimental cli", () => {
]
.flatMap((args) => [args, [...args, "--no-parallel"]])
.entries()) {
test(`'${args.join(" ")}'`, async () => {
test(args.join(" "), async () => {
// Since we are not able to mock file write, so we just let the CLI actually write it
const directory = new URL(
`../cli/experimental-cli/test-${index}/`,