Skip to content

Commit 7cb16af

Browse files
committed
fix: select Playwright file suites rather than test declaration locations
1 parent 966673f commit 7cb16af

1 file changed

Lines changed: 3 additions & 12 deletions

File tree

‎scripts/desktop-e2e.ts‎

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,9 @@ import { partitionFiles } from '@scripts/duration-shards'
55
import { createLogger } from '@sim/logger'
66
import { escapeRegExp } from '@sim/utils/string'
77

8-
interface Suite {
9-
specs?: { file: string }[]
10-
suites?: Suite[]
11-
}
12-
138
interface DiscoveryReport {
149
config: { rootDir: string }
15-
suites: Suite[]
10+
suites: { file: string }[]
1611
errors: unknown[]
1712
}
1813

@@ -36,12 +31,8 @@ if (discovery.status !== 0) process.exit(discovery.status ?? 1)
3631
const discoveryJson = readFileSync(discoveryPath, 'utf8')
3732
const report = JSON.parse(discoveryJson) as DiscoveryReport
3833
if (report.errors.length > 0) throw new Error('Playwright discovery reported errors')
39-
const files = new Set<string>()
40-
function visit(suite: Suite): void {
41-
for (const spec of suite.specs ?? []) files.add(spec.file)
42-
for (const child of suite.suites ?? []) visit(child)
43-
}
44-
for (const suite of report.suites) visit(suite)
34+
// A test factory can declare tests in a helper; the outer suite owns the discoverable test file.
35+
const files = new Set(report.suites.map((suite) => suite.file))
4536
if (count > files.size) throw new Error('More desktop shards than discovered test files')
4637
const durations = JSON.parse(
4738
readFileSync(new URL('../apps/desktop/e2e-durations.json', import.meta.url), 'utf8')

0 commit comments

Comments
 (0)