MCPcopy Create free account
hub / github.com/Doorman11991/smallcode / withTempConfig

Function withTempConfig

test/config_normalize.test.js:70–86  ·  view source on GitHub ↗
(toml, fn)

Source from the content-addressed store, hash-verified

68});
69
70function withTempConfig(toml, fn) {
71 const prevCwd = process.cwd();
72 const prevEnv = { ...process.env };
73 const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'smallcode-config-'));
74 fs.writeFileSync(path.join(dir, 'smallcode.toml'), toml);
75 process.chdir(dir);
76 for (const key of Object.keys(process.env)) {
77 if (key.startsWith('SMALLCODE_') || key === 'OLLAMA_HOST') delete process.env[key];
78 }
79 try {
80 return fn();
81 } finally {
82 process.chdir(prevCwd);
83 process.env = prevEnv;
84 fs.rmSync(dir, { recursive: true, force: true });
85 }
86}
87
88test('smallcode.toml loads per-tier model targets', () => {
89 withTempConfig(`

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected