mirror of
https://github.com/firecow/gitlab-ci-local.git
synced 2026-06-01 18:37:36 +02:00
fix: --completion outputs wrong script name when run via Bun (#1826)
This commit is contained in:
+1
-1
@@ -30,7 +30,7 @@ export async function handler (args: any, writeStreams: WriteStreams, jobs: Job[
|
||||
let parser: Parser;
|
||||
|
||||
if (argv.completion) {
|
||||
yargs(process.argv.slice(2)).showCompletionScript();
|
||||
yargs(process.argv.slice(2)).scriptName("gitlab-ci-local").showCompletionScript();
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import {execSync} from "child_process";
|
||||
|
||||
// Runs the CLI as a subprocess to reliably capture console.log output,
|
||||
// which Bun implements natively and cannot be intercepted with vi.spyOn.
|
||||
test("--completion outputs gitlab-ci-local as script name", () => {
|
||||
const output = execSync("bun src/index.ts --completion", {encoding: "utf8", stdio: ["pipe", "pipe", "pipe"]});
|
||||
|
||||
expect(output).toContain("###-begin-gitlab-ci-local-completions-###");
|
||||
expect(output).toContain("###-end-gitlab-ci-local-completions-###");
|
||||
expect(output).toContain("gitlab-ci-local --get-yargs-completions");
|
||||
expect(output).not.toMatch(/###-begin-(?!gitlab-ci-local)/);
|
||||
});
|
||||
+5
-2
@@ -7,7 +7,10 @@ export default defineConfig({
|
||||
extends: true,
|
||||
test: {
|
||||
name: "forks",
|
||||
include: ["tests/test-cases/argv-cwd/**/*.test.ts"],
|
||||
include: [
|
||||
"tests/test-cases/argv-cwd/**/*.test.ts",
|
||||
"tests/test-cases/completion/**/*.test.ts",
|
||||
],
|
||||
pool: "forks",
|
||||
},
|
||||
},
|
||||
@@ -16,7 +19,7 @@ export default defineConfig({
|
||||
test: {
|
||||
name: "threads",
|
||||
include: ["tests/**/*.test.ts"],
|
||||
exclude: [...configDefaults.exclude, "**/.gitlab-ci-local*/**", "tests/test-cases/argv-cwd/**/*.test.ts"],
|
||||
exclude: [...configDefaults.exclude, "**/.gitlab-ci-local*/**", "tests/test-cases/argv-cwd/**/*.test.ts", "tests/test-cases/completion/**/*.test.ts"],
|
||||
pool: "threads",
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user