Skip to content

Commit 05345ca

Browse files
committed
fix(test): resolve vitest path in integration and e2e scripts
The integration and e2e scripts were using 'vitest' as a bare command, which fails in CI environments where node_modules/.bin is not in PATH. This caused "Unknown command: vitest" errors. Resolved by adding vitest path resolution matching the dotenvx pattern: - Resolve full path to vitest binary in node_modules/.bin - Handle Windows .cmd extension for cross-platform compatibility - Pass resolved path to dotenvx wrapper This completes the fix started in 240a09e and ensures both dotenvx and vitest commands work in CI environments.
1 parent e23ad16 commit 05345ca

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

packages/cli/scripts/e2e.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ async function runVitest(binaryType) {
9898
const dotenvxCmd = WIN32 ? 'dotenvx.cmd' : 'dotenvx'
9999
const dotenvxPath = path.join(NODE_MODULES_BIN_PATH, dotenvxCmd)
100100

101+
// Resolve vitest path.
102+
const vitestCmd = WIN32 ? 'vitest.cmd' : 'vitest'
103+
const vitestPath = path.join(NODE_MODULES_BIN_PATH, vitestCmd)
104+
101105
const result = await spawn(
102106
dotenvxPath,
103107
[
@@ -106,7 +110,7 @@ async function runVitest(binaryType) {
106110
'-f',
107111
'.env.e2e',
108112
'--',
109-
'vitest',
113+
vitestPath,
110114
'run',
111115
'test/e2e/binary-test-suite.e2e.test.mts',
112116
'--config',

packages/cli/scripts/integration.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ async function runVitest(binaryType) {
101101
const dotenvxCmd = WIN32 ? 'dotenvx.cmd' : 'dotenvx'
102102
const dotenvxPath = path.join(NODE_MODULES_BIN_PATH, dotenvxCmd)
103103

104+
// Resolve vitest path.
105+
const vitestCmd = WIN32 ? 'vitest.cmd' : 'vitest'
106+
const vitestPath = path.join(NODE_MODULES_BIN_PATH, vitestCmd)
107+
104108
const result = await spawn(
105109
dotenvxPath,
106110
[
@@ -109,7 +113,7 @@ async function runVitest(binaryType) {
109113
'-f',
110114
'.env.test',
111115
'--',
112-
'vitest',
116+
vitestPath,
113117
'run',
114118
'test/integration/binary/binary-test-suite.test.mts',
115119
'--config',

0 commit comments

Comments
 (0)