fix(playwright): screenshot path resolving to filesystem root#330
Merged
Conversation
…empty
When no `projects` are configured in the Playwright config, the implicit
default project has an empty name. `getSnapshotNames` prefixed the screenshot
name with `${project.name}/`, producing a leading slash (e.g. `/hero`). Passed
to `path.resolve(root, name)`, the absolute name discards `root` and resolves
to the filesystem root, causing `EACCES: permission denied` when writing the
`.argos.json` metadata on CI.
Only prefix the name when the project name is non-empty.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Playwright rewrites every non-builtin reporter id to an absolute resolved path (e.g. `…/node_modules/@argos-ci/playwright/dist/reporter.mjs`) when loading the config. The detection only matched the `@argos-ci/playwright/reporter` import specifier, which never appears in the resolved path (it ends in `/dist/reporter.mjs`), and relied on a fragile exact-path equality fallback. As a result the reporter went undetected and screenshots fell back to the `resolve(root, name)` write path. Match the `@argos-ci/playwright` package directory instead, which is present in both the raw specifier and the resolved path (including pnpm layouts), and guard `require.resolve` so an unresolvable entry point no longer throws. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
jsfez
approved these changes
Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #329.
Problem
On CI,
argosScreenshot()failed withEACCES: permission denied, open '/<name>.png.argos.json'— the metadata/screenshot path resolved to the filesystem root (/).This required two bugs to line up, both present in the reporter's environment:
Empty project name → absolute name. With no
projectsarray in the Playwright config, the implicit default project has an empty name.getSnapshotNamesprefixed the name with${project.name}/, yielding a leading slash (/hero…). Passed topath.resolve(root, name), the absolute name discardsrootand resolves to/. This is also why the reporter's documentedrootoverride had no effect.Reporter not detected. Playwright rewrites every non-builtin reporter id to an absolute resolved path (
…/node_modules/@argos-ci/playwright/dist/reporter.mjs).checkIsUsingArgosReporteronly matched the@argos-ci/playwright/reporterimport specifier — which never appears in the resolved path (it ends in/dist/reporter.mjs) — and relied on a fragile exact-path equality fallback. So the reporter went undetected and screenshots fell into theresolve(root, name)write path above.Fix
Two independent commits, either of which stops the crash; together they also fix the root cause behind it:
@argos-ci/playwrightpackage directory (present in both the raw specifier and the resolved path, including pnpm layouts), and guardrequire.resolveagainst throwing.Tests
Added 9 unit tests in
util.test.tscovering the empty-project-name case and reporter detection from resolved/pnpm paths (19 passing).check-typesis clean.🤖 Generated with Claude Code