fix(e2e): let per-file E2E targets run without mock serve dependencies

Since #1710 the Playwright configs start the Stalker and Xtream mocks
themselves (`node --import tsx …`), so @nx/playwright can no longer map
those webServers to Nx tasks and infers the atomized `e2e-ci--*` targets
as non-parallel. The `e2e-ci--src/*.e2e.ts` target default still made
them depend on the continuous `stalker-mock-server:serve` and
`xtream-mock-server:serve` targets, and Nx refuses to run a
non-parallel task with continuous dependencies, so every per-file
target failed before running anything.

Drop the redundant mock dependencies and keep the Electron build.
The mock-launch guard spec now also rejects any nx.json target default
that depends on a mock-server task.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
4grayandClaude Opus 5.5 committed 2026-09-30 22:22:57 +02:00
1 parent 525ca7bc44
commit 5985be7449
3 files changed
+44 -5

No files matched your search

@@ -87,3 +87,43 @@ describe('Playwright mock-server launch', () => {
}
);
});
describe('Nx E2E target defaults', () => {
type DependsOn = Array<string | { projects?: string[]; target?: string }>;
const nxJson = JSON.parse(
readFileSync(join(process.cwd(), 'nx.json'), 'utf8')
) as {
targetDefaults: Record<string, { dependsOn?: DependsOn }>;
};
// The Playwright configs start the mocks themselves, so @nx/playwright
// infers the atomized e2e-ci targets as non-parallel, and Nx refuses to
// run a non-parallel task that depends on a continuous `serve` task.
it('never makes an E2E target depend on a mock-server task', () => {
const mockDependencies = Object.entries(nxJson.targetDefaults)
.flatMap(([targetName, config]) =>
(config.dependsOn ?? []).map((dependency) => ({
targetName,
dependency,
}))
)
.filter(({ dependency }) =>
typeof dependency === 'string'
? dependency.includes('-mock-server:')
: (dependency.projects ?? []).some((project) =>
project.endsWith('-mock-server')
)
);
expect(mockDependencies).toEqual([]);
});
it('still builds the Electron app before each per-file E2E target', () => {
expect(
nxJson.targetDefaults['e2e-ci--src/*.e2e.ts']?.dependsOn
).toContainEqual({
projects: ['electron-backend'],
target: 'build-e2e',
});
});
});