Fix CI test failures from Bun.spawn in vitest - #1821
Merged
Conversation
Bun global is not available when vitest runs tests in Node.js worker threads, causing ReferenceError in CI.
Contributor
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="tests/test-cases/gcl-env-variable-split/integration.test.ts">
<violation number="1" location="tests/test-cases/gcl-env-variable-split/integration.test.ts:196">
P2: `runCli` can incorrectly report `exitCode: 0` when `execFile` fails with a non-numeric error code. Treat non-exit errors as failures instead of coercing them to success.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Comment on lines
+196
to
+197
| resolve({stdout, exitCode: typeof error?.code === "number" ? error.code : 0}); | ||
| }); |
Contributor
There was a problem hiding this comment.
P2: runCli can incorrectly report exitCode: 0 when execFile fails with a non-numeric error code. Treat non-exit errors as failures instead of coercing them to success.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/test-cases/gcl-env-variable-split/integration.test.ts, line 196:
<comment>`runCli` can incorrectly report `exitCode: 0` when `execFile` fails with a non-numeric error code. Treat non-exit errors as failures instead of coercing them to success.</comment>
<file context>
@@ -186,63 +187,32 @@ test("GCL_VARIABLE env split reaches handler as separate variables", async () =>
+ env: {...process.env, ...envVars},
+ }, (error, stdout) => {
+ if (error && error.code === undefined) return reject(error);
+ resolve({stdout, exitCode: typeof error?.code === "number" ? error.code : 0});
+ });
+ });
</file context>
Suggested change
| resolve({stdout, exitCode: typeof error?.code === "number" ? error.code : 0}); | |
| }); | |
| if (error) { | |
| if (typeof error.code === "number") { | |
| return resolve({stdout, exitCode: error.code}); | |
| } | |
| return reject(error); | |
| } | |
| resolve({stdout, exitCode: 0}); |
|
kevingerman
pushed a commit
to kevingerman/gitlab-ci-local
that referenced
this pull request
Apr 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Bun.spawnwithchild_process.execFilein gcl-env-variable-split testsBunglobal is unavailable when vitest runs in Node.js worker threadsyparser.getOptions()which lacks type definitionsFixes test and typecheck failures introduced by #1778.
Summary by cubic
Fix CI test failures by replacing
Bun.spawnwithchild_process.execFilein the gcl-env-variable-split integration tests, sinceBunisn’t available undervitestNode worker threads. Also adds a small type fix foryparser.getOptions().runClihelper usingexecFileto invokebun src/index.tswith env vars.yparser.getOptions()to address missing type definitions.Written for commit cd5f5e3. Summary will update on new commits.