test(e2e): check TSX_TSCONFIG_PATH per mock webServer entry

The mock launch guard counted every TSX_TSCONFIG_PATH in the Playwright
config, so web-e2e's single-process web-backend entry made it see three
for two mocks. Check the variable inside each mock's own entry instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
4grayandClaude Opus 5.5 committed 2026-09-29 09:13:56 +02:00
1 parent 245e16cb14
commit 65e84f871a
1 file changed
+9 -6
@@ -70,17 +70,20 @@ describe('Playwright mock-server launch', () => {
const source = readSource(configPath);
expect(source).not.toMatch(/\bnx\b[^'"`\n]*mock-server/);
// Other single-process webServers (web-e2e's web-backend) also set
// TSX_TSCONFIG_PATH, so check it inside each mock's own entry.
for (const mock of mocks) {
expect(source).toContain(
`'node --import tsx apps/${mock}-mock-server/src/main.ts'`
);
const launch = `'node --import tsx apps/${mock}-mock-server/src/main.ts'`;
const start = source.indexOf(launch);
expect(start).toBeGreaterThan(-1);
expect(
source.slice(start, source.indexOf('url:', start))
).toContain("TSX_TSCONFIG_PATH: 'tsconfig.base.json'");
}
expect(
source.match(/node --import tsx apps\/[\w-]+-mock-server\//g)
).toHaveLength(mocks.length);
expect(
source.match(/TSX_TSCONFIG_PATH: 'tsconfig\.base\.json'/g)
).toHaveLength(mocks.length);
}
);
});