MCPcopy
hub / github.com/garrytan/gstack / withTempFile

Function withTempFile

test/test-free-shards.test.ts:49–58  ·  view source on GitHub ↗
(content: string, fn: (filePath: string) => void)

Source from the content-addressed store, hash-verified

47
48describe('test-free-shards: Windows curation', () => {
49 function withTempFile(content: string, fn: (filePath: string) => void): void {
50 const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'curation-test-'));
51 const file = path.join(dir, 'sample.test.ts');
52 fs.writeFileSync(file, content);
53 try {
54 fn(file);
55 } finally {
56 fs.rmSync(dir, { recursive: true, force: true });
57 }
58 }
59
60 test('detects /bin/bash hardcode', () => {
61 withTempFile(`spawn('/bin/bash', ['-c', 'echo hi']);`, (f) => {

Callers 1

Calls 1

fnFunction · 0.85

Tested by

no test coverage detected