(filePath: string, source: string, minNodes = 3)
| 81 | }); |
| 82 | |
| 83 | function assertParity(filePath: string, source: string, minNodes = 3): void { |
| 84 | process.env.CODEGRAPH_KERNEL_LANGS = 'all'; |
| 85 | delete process.env.CODEGRAPH_KERNEL; |
| 86 | const viaKernel = tryKernelExtract(filePath, source, 'swift'); |
| 87 | expect(viaKernel, `kernel extraction failed for ${filePath}`).not.toBeNull(); |
| 88 | |
| 89 | process.env.CODEGRAPH_KERNEL = '0'; |
| 90 | const viaWasm = extractFromSource(filePath, source, 'swift'); |
| 91 | delete process.env.CODEGRAPH_KERNEL; |
| 92 | |
| 93 | const k = canon(viaKernel!); |
| 94 | const w = canon(viaWasm); |
| 95 | expect(k.nodes, `${filePath}: nodes`).toEqual(w.nodes); |
| 96 | expect(k.edges, `${filePath}: edges`).toEqual(w.edges); |
| 97 | expect(k.refs, `${filePath}: refs`).toEqual(w.refs); |
| 98 | expect(viaWasm.nodes.length).toBeGreaterThanOrEqual(minNodes); |
| 99 | } |
| 100 | |
| 101 | it('torture fixture: property branch, extensions, call matrix, value refs, fn-refs', () => { |
| 102 | const file = path.join(FIXTURE_DIR, 'torture.swift'); |
no test coverage detected