Skip to content

fix(cli): use resolve instead of join for report path in open command#688

Merged
todti merged 3 commits into
mainfrom
fix/open-command-double-path
Jun 5, 2026
Merged

fix(cli): use resolve instead of join for report path in open command#688
todti merged 3 commits into
mainfrom
fix/open-command-double-path

Conversation

@todti

@todti todti commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • resolveConfig always resolves output to an absolute path via path.resolve
  • resolveReportPath used path.join(cwd, fallback) where fallback could be that absolute path
  • path.join does not treat an absolute second argument as absolute — it strips the leading / and concatenates, producing a doubled path like /sandbox/Users/.../sandbox/allure-report
  • Fix: use path.resolve(cwd, path) which correctly passes through absolute paths and resolves relative ones against cwd

Reproduces when running allure open without a path argument (the fallback config.output is absolute).

path.join does not treat an absolute second argument as absolute —
it concatenates both, stripping the leading slash. resolveConfig
always returns an absolute output path, so when allure open is
invoked without a path argument the fallback config.output was
doubled into the cwd, producing a path like:
  /sandbox/Users/.../sandbox/allure-report

Switching to path.resolve fixes this: if the fallback is already
absolute it is returned as-is; if it is relative it is resolved
against cwd, which is the correct behaviour in both cases.
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

Allure Report Summary

Name Duration Stats New Flaky Retry Report
Allure 3 Report 25m 23s Passed tests 1491   Skipped tests 15 0 0 0 View
My Dashboard 25m 23s Passed tests 1491   Skipped tests 15 0 0 0 View
Allure 3 GitHub actions run (2026-06-05T09:51:38.564Z) 25m 23s Passed tests 1491   Skipped tests 15 0 0 0 View

…path

path.join(cwd, absolutePath) strips the leading slash of the second
argument and concatenates, doubling the path. Use isAbsolute() to
short-circuit: if the resolved config.output is already absolute
(which readConfig always produces), return it directly; otherwise
fall back to join(cwd, relativePath) for relative inputs.
path.resolve(cwd, path) already handles both cases correctly:
- absolute path as second arg → returns it unchanged
- relative path → resolves against cwd

Update tests to use resolve() in expectations so they reflect
real path semantics instead of relative string concatenation.
@todti todti merged commit 2a4bdf8 into main Jun 5, 2026
11 checks passed
@todti todti deleted the fix/open-command-double-path branch June 5, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants