Skip to content

Commit d8f6038

Browse files
committed
Fix Vite version checks
1 parent fdac9ae commit d8f6038

2 files changed

Lines changed: 27 additions & 34 deletions

File tree

packages/integration-tests-next/fixtures/vite4/utils.ts

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { TestContext, test as vitestTest } from "vitest";
66
import { execSync } from "node:child_process";
77

88
const cwd = dirname(fileURLToPath(import.meta.url));
9-
const NODE_MAJOR_VERSION = parseInt(process.versions.node.split(".")[0] || "0", 10);
109

1110
type TestCallback = (props: {
1211
outDir: string;
@@ -26,37 +25,31 @@ export function test(url: string, callback: TestCallback) {
2625
// Clear the output directory before running the test
2726
rmSync(outDir, { recursive: true, force: true });
2827

29-
// Vite v8 requires Node 20+
30-
if (NODE_MAJOR_VERSION < 20) {
31-
// eslint-disable-next-line @typescript-eslint/no-empty-function
32-
vitestTest.skip(testName);
33-
} else {
34-
vitestTest(`Vite v4 > ${testName}`, (ctx) =>
35-
callback({
36-
outDir,
37-
runBundler: (env) =>
38-
runBundler(
39-
`vite build --config ${testName}.config.ts`,
40-
{
41-
cwd,
42-
env: {
43-
...process.env,
44-
...env,
45-
},
46-
},
47-
outDir
48-
),
49-
readOutputFiles: () => readAllFiles(outDir),
50-
runFileInNode: (file) => {
51-
const fullPath = join(outDir, file);
52-
return execSync(`node ${fullPath}`, {
28+
vitestTest(`Vite v4 > ${testName}`, (ctx) =>
29+
callback({
30+
outDir,
31+
runBundler: (env) =>
32+
runBundler(
33+
`vite build --config ${testName}.config.ts`,
34+
{
5335
cwd,
54-
env: { ...process.env, NO_COLOR: "1", FORCE_COLOR: "0" },
55-
}).toString();
56-
},
57-
createTempDir: () => createTempDir(),
58-
ctx,
59-
})
60-
);
61-
}
36+
env: {
37+
...process.env,
38+
...env,
39+
},
40+
},
41+
outDir
42+
),
43+
readOutputFiles: () => readAllFiles(outDir),
44+
runFileInNode: (file) => {
45+
const fullPath = join(outDir, file);
46+
return execSync(`node ${fullPath}`, {
47+
cwd,
48+
env: { ...process.env, NO_COLOR: "1", FORCE_COLOR: "0" },
49+
}).toString();
50+
},
51+
createTempDir: () => createTempDir(),
52+
ctx,
53+
})
54+
);
6255
}

packages/integration-tests-next/fixtures/vite7/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function test(url: string, callback: TestCallback) {
2626
// Clear the output directory before running the test
2727
rmSync(outDir, { recursive: true, force: true });
2828

29-
// Vite v8 requires Node 20+
29+
// Vite v7 requires Node 20+
3030
if (NODE_MAJOR_VERSION < 20) {
3131
// eslint-disable-next-line @typescript-eslint/no-empty-function
3232
vitestTest.skip(testName);

0 commit comments

Comments
 (0)