You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: JSON reporter emits a separate spec per project when testDir is not the current directory #43266
Tests inside test.describe are duplicated the same way, so the shape of the report depends on the directory the command is run from.
Additional context
_mergeTestsFromSuite in packages/playwright/src/reporters/json.ts matches specs with s.file === toPosixPath(path.relative(this.config.rootDir, spec.file)). spec.file is already relative to rootDir (it comes from _relativeLocation), so path.relative resolves it against process.cwd() and the comparison only succeeds when cwd is rootDir. Suites in the same function are matched with _locationMatches, which would work for specs too.
This seems to date back to 1.27, when the comparison switched from test.location.file (absolute) to spec.file (relative).
I'd like to send a PR with this fix and a regression test in tests/playwright-test/reporter-json.spec.ts.
Activity