From f03061ae8d12d329faf08b6f6d1e6e689e6affc7 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Fri, 6 Jun 2025 03:06:03 +0800 Subject: [PATCH] Fix experimental-cli test (#17570) --- .../__snapshots__/experimental-cli.js.snap | 22 +++++++++---------- .../integration/__tests__/experimental-cli.js | 3 ++- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/tests/integration/__tests__/__snapshots__/experimental-cli.js.snap b/tests/integration/__tests__/__snapshots__/experimental-cli.js.snap index 7cc866479..a80ecf442 100644 --- a/tests/integration/__tests__/__snapshots__/experimental-cli.js.snap +++ b/tests/integration/__tests__/__snapshots__/experimental-cli.js.snap @@ -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": "", diff --git a/tests/integration/__tests__/experimental-cli.js b/tests/integration/__tests__/experimental-cli.js index 4af53c818..b713eaebc 100644 --- a/tests/integration/__tests__/experimental-cli.js +++ b/tests/integration/__tests__/experimental-cli.js @@ -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}/`,