Skip to content

Commit 027dcff

Browse files
authored
chore: improve bootstrap-cli and snap-test output handling (#323)
1 parent 39038a3 commit 027dcff

3 files changed

Lines changed: 15 additions & 6 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"type": "module",
1010
"scripts": {
11-
"bootstrap-cli": "pnpm --filter=@voidzero-dev/vite-plus build && pnpm --filter=@voidzero-dev/global build && pnpm install-global-cli",
11+
"bootstrap-cli": "pnpm --filter=@voidzero-dev/* build && pnpm install-global-cli",
1212
"bootstrap-cli:ci": "pnpm --filter=@voidzero-dev/global build && pnpm install-global-cli",
1313
"install-global-cli": "npm install -g ./packages/global",
1414
"typecheck": "tsc -b tsconfig.json",

packages/tools/src/snap-test.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,9 @@ async function runTestCase(name: string, tempTmpDir: string, casesDir: string) {
184184
stdin: null,
185185
// Declared to be `Writable` but `FileHandle` works too.
186186
// @ts-expect-error
187-
stderr: cmd.ignoreOutput ? null : outputStream,
187+
stderr: outputStream,
188188
// @ts-expect-error
189-
stdout: cmd.ignoreOutput ? null : outputStream,
189+
stdout: outputStream,
190190
glob: {
191191
// Disable glob expansion. Pass args like '--filter=*' as-is.
192192
isGlobPattern: () => false,
@@ -198,11 +198,17 @@ async function runTestCase(name: string, tempTmpDir: string, casesDir: string) {
198198

199199
await outputStream.close();
200200

201-
const output = readFileSync(outputStreamPath, 'utf-8');
201+
let output = readFileSync(outputStreamPath, 'utf-8');
202202

203203
let commandLine = `> ${cmd.command}`;
204204
if (exitCode !== 0) {
205-
commandLine = (exitCode === undefined ? '[timeout]' : `[${exitCode}]`) + commandLine;
205+
commandLine =
206+
(exitCode === undefined ? '[timeout]' : `[${exitCode}]`) + commandLine;
207+
} else {
208+
// only allow ignore output if the command is successful
209+
if (cmd.ignoreOutput) {
210+
output = '';
211+
}
206212
}
207213
newSnap.push(commandLine);
208214
if (output.length > 0) {

vite-task.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
"rolldown#build-binding:release",
88
"rolldown#build-node",
99
"rolldown-vite#build-types",
10-
"@voidzero-dev/vite-plus#build"
10+
"@voidzero-dev/vite-plus-test#build",
11+
"@voidzero-dev/vite-plus-core#build",
12+
"@voidzero-dev/vite-plus#build",
13+
"@voidzero-dev/global#build"
1114
],
1215
"cacheable": false
1316
}

0 commit comments

Comments
 (0)