|
1 | 1 | import { describe, test, expect } from "bun:test"; |
2 | 2 | import { mkdtemp, mkdir, writeFile, rm } from "node:fs/promises"; |
3 | 3 | import { tmpdir } from "node:os"; |
4 | | -import { join } from "node:path"; |
| 4 | +import { join, resolve } from "node:path"; |
5 | 5 |
|
6 | 6 | import { |
7 | 7 | buildBifrostSource, |
@@ -803,22 +803,23 @@ describe("loadConfig", () => { |
803 | 803 | await expect(loadConfig(["--model"], { globalSettingsPath: NO_SETTINGS })).rejects.toThrow( |
804 | 804 | "--model requires a value", |
805 | 805 | ); |
| 806 | + await expect(loadConfig(["--cwd"], { globalSettingsPath: NO_SETTINGS })).rejects.toThrow( |
| 807 | + "--cwd requires a value", |
| 808 | + ); |
| 809 | + await expect(loadConfig(["--config"], { globalSettingsPath: NO_SETTINGS })).rejects.toThrow( |
| 810 | + "--config requires a value", |
| 811 | + ); |
| 812 | + await expect(loadConfig(["--profile"], { globalSettingsPath: NO_SETTINGS })).rejects.toThrow( |
| 813 | + "--profile requires a value", |
| 814 | + ); |
806 | 815 | }); |
807 | 816 |
|
808 | 817 | test("value flags accept a POSIX path that starts with a single dash", async () => { |
809 | | - const parent = await emptyCwd(); |
810 | | - const dashedCwd = join(parent, "-my-dir"); |
811 | | - await mkdir(dashedCwd); |
812 | | - try { |
813 | | - const globalPath = await writeGlobalSettings(dashedCwd); |
814 | | - const config = await loadConfig(["--cwd", dashedCwd, "do something"], { |
815 | | - globalSettingsPath: globalPath, |
816 | | - }); |
817 | | - assertConfigured(config); |
818 | | - expect(config.cwd).toBe(dashedCwd); |
819 | | - } finally { |
820 | | - await rm(parent, { recursive: true, force: true }); |
821 | | - } |
| 818 | + const config = await loadConfig(["--cwd", "-my-dir", "do something"], { |
| 819 | + allowUnconfigured: true, |
| 820 | + globalSettingsPath: NO_SETTINGS, |
| 821 | + }); |
| 822 | + expect(config.cwd).toBe(resolve("-my-dir")); |
822 | 823 | }); |
823 | 824 |
|
824 | 825 | test("rejects unknown flags", async () => { |
|
0 commit comments