MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / withTempFile

Function withTempFile

tests/lint-test-dynamic-imports.test.cjs:22–31  ·  view source on GitHub ↗
(name, contents, fn)

Source from the content-addressed store, hash-verified

20const { lint, scanFile } = require('../scripts/lint-test-dynamic-imports.cjs');
21
22function withTempFile(name, contents, fn) {
23 const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'lint-tdi-'));
24 const file = path.join(dir, name);
25 fs.writeFileSync(file, contents);
26 try {
27 return fn(file);
28 } finally {
29 fs.rmSync(dir, { recursive: true, force: true });
30 }
31}
32
33test('source tree passes the lint', () => {
34 const violations = lint();

Calls

no outgoing calls

Tested by

no test coverage detected