MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / loaded

Function loaded

__tests__/lazy-frameworks.test.ts:14–24  ·  view source on GitHub ↗

The dist modules a thread has loaded after running `code`.

(code: string)

Source from the content-addressed store, hash-verified

12
13/** The dist modules a thread has loaded after running `code`. */
14function loaded(code: string): string[] {
15 const script = `
16 const { extractFromSource } = require(${JSON.stringify(path.join(dist, 'extraction/tree-sitter.js'))});
17 ${code}
18 console.log(JSON.stringify(Object.keys(require.cache)));
19 process.exit(0);
20 `;
21 const res = spawnSync(process.execPath, ['--disable-warning=ExperimentalWarning', '-e', script], { encoding: 'utf8' });
22 expect(res.status, res.stderr).toBe(0);
23 return (JSON.parse(res.stdout) as string[]).map((f) => path.relative(dist, f).split(path.sep).join('/'));
24}
25
26describe('framework resolvers in extraction', () => {
27 it('are not loaded for a file no framework reads', () => {

Callers 1

Calls 3

mapMethod · 0.80
parseMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected