Skip to content

Commit ee4f74b

Browse files
committed
test(integration): parallelize beforeAll builds and tighten d.bark() assertions (#1428)
- Run both WASM and native buildGraph calls concurrently via Promise.all; fixtures are already written to separate dirs before either build starts - Pin d.bark() assertions to src === 'proto.js' (the file-level scope node) so the check no longer matches any edge that targets Dog.bark
1 parent ad5e5ad commit ee4f74b

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

tests/integration/prototype-method-resolution.test.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,14 @@ let tmpNative: string;
4545
beforeAll(async () => {
4646
tmpWasm = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-1317-wasm-'));
4747
fs.writeFileSync(path.join(tmpWasm, 'proto.js'), FIXTURE_CODE);
48-
await buildGraph(tmpWasm, { incremental: false, skipRegistry: true, engine: 'wasm' });
4948

5049
tmpNative = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-1317-native-'));
5150
fs.writeFileSync(path.join(tmpNative, 'proto.js'), FIXTURE_CODE);
52-
await buildGraph(tmpNative, { incremental: false, skipRegistry: true, engine: 'native' });
51+
52+
await Promise.all([
53+
buildGraph(tmpWasm, { incremental: false, skipRegistry: true, engine: 'wasm' }),
54+
buildGraph(tmpNative, { incremental: false, skipRegistry: true, engine: 'native' }),
55+
]);
5356
});
5457

5558
afterAll(() => {
@@ -95,7 +98,7 @@ describe('prototype method resolution (#1317)', () => {
9598

9699
it('WASM: resolves d.bark() call to Dog.bark via typeMap receiver type', () => {
97100
const edges = readCallEdges(path.join(tmpWasm, '.codegraph', 'graph.db'));
98-
expect(edges.find((e) => e.tgt === 'Dog.bark')).toBeDefined();
101+
expect(edges.find((e) => e.src === 'proto.js' && e.tgt === 'Dog.bark')).toBeDefined();
99102
});
100103

101104
it('WASM: resolves (new Dog(...)).bark() inline-new receiver call to Dog.bark', () => {
@@ -111,7 +114,7 @@ describe('prototype method resolution (#1317)', () => {
111114

112115
it('Native: resolves d.bark() call to Dog.bark via typeMap receiver type', () => {
113116
const edges = readCallEdges(path.join(tmpNative, '.codegraph', 'graph.db'));
114-
expect(edges.find((e) => e.tgt === 'Dog.bark')).toBeDefined();
117+
expect(edges.find((e) => e.src === 'proto.js' && e.tgt === 'Dog.bark')).toBeDefined();
115118
});
116119

117120
it('Native: resolves (new Dog(...)).bark() inline-new receiver call to Dog.bark', () => {

0 commit comments

Comments
 (0)