From 24921a4e56489d6aa6fd86f9f2054e7afe3b591e Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Mon, 11 Aug 2025 16:02:28 +0800 Subject: [PATCH] Fix typescript config test on Node.js v22 (#17787) --- .../__tests__/config-file-typescript.js | 27 +++---------------- 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/tests/integration/__tests__/config-file-typescript.js b/tests/integration/__tests__/config-file-typescript.js index d1962f3ae..f24b82ff4 100644 --- a/tests/integration/__tests__/config-file-typescript.js +++ b/tests/integration/__tests__/config-file-typescript.js @@ -16,18 +16,13 @@ const TAB_WIDTH_3_OUTPUT = outdent` } `; -// Node.js>=22 supports ts files, 22 requires experimental flag, 23 doesn't +// Node.js>=22 supports ts files if (NODE_JS_MAJOR_VERSION >= 22) { - const nodeOptions = NODE_JS_MAJOR_VERSION === 22 ? NODE_TS_SUPPORT_FLAGS : []; - test("Should support typescript config files", async () => { const output = await runCli( "cli/config/ts/auto-discovery/", ["--stdin-filepath", "foo.js"], - { - input: code, - nodeOptions, - }, + { input: code }, ).stdout; expect(output).toBe(TAB_WIDTH_3_OUTPUT); @@ -46,10 +41,7 @@ if (NODE_JS_MAJOR_VERSION >= 22) { const output = await runCli( "cli/config/ts/config-file-names/", ["--stdin-filepath", "foo.js", "--config", configFileName], - { - input: code, - nodeOptions, - }, + { input: code }, ).stdout; expect(getOutputTabWidth(output)).toBe(expectedTabWidth); @@ -58,19 +50,6 @@ if (NODE_JS_MAJOR_VERSION >= 22) { }); } -if (NODE_JS_MAJOR_VERSION === 22) { - test("Should throw errors when flags are missing", () => { - runCli("cli/config/ts/auto-discovery/", ["--stdin-filepath", "foo.js"], { - input: code, - }).test({ - status: "non-zero", - stdout: "", - write: [], - stderr: expect.stringMatching(/Unknown file extension ".ts" for/u), - }); - }); -} - if (NODE_JS_MAJOR_VERSION < 22) { test("Should throw errors when Node.js < 22", () => { runCli("cli/config/ts/auto-discovery/", ["--stdin-filepath", "foo.js"], {