summaryrefslogtreecommitdiffhomepage
path: root/packages/core/tests/config/loader.test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/core/tests/config/loader.test.ts')
-rw-r--r--packages/core/tests/config/loader.test.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/core/tests/config/loader.test.ts b/packages/core/tests/config/loader.test.ts
index de025de..0d84d0b 100644
--- a/packages/core/tests/config/loader.test.ts
+++ b/packages/core/tests/config/loader.test.ts
@@ -6,12 +6,20 @@ import { configToRuleset, loadConfig } from "../../src/config/loader.js";
const TMP = join("/tmp/opencode", "dispatch-config-test");
+// Point the global config at a path that does not exist so these tests are
+// hermetic — they must not pick up this machine's real
+// ~/.config/dispatch/dispatch.toml.
+const prevGlobal = process.env.DISPATCH_GLOBAL_CONFIG;
+
beforeEach(() => {
mkdirSync(TMP, { recursive: true });
+ process.env.DISPATCH_GLOBAL_CONFIG = join(TMP, "__no_such_global__.toml");
});
afterEach(() => {
rmSync(TMP, { recursive: true, force: true });
+ if (prevGlobal === undefined) delete process.env.DISPATCH_GLOBAL_CONFIG;
+ else process.env.DISPATCH_GLOBAL_CONFIG = prevGlobal;
});
function writeToml(content: string): void {