Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Runner config rootPath is resolved relative to cwd, not the path of the config #2720

Open
jahorton opened this issue Apr 30, 2024 · 0 comments

Comments

@jahorton
Copy link

jahorton commented Apr 30, 2024

The rootPath used by the server, which affects paths that need manually loading during tests, is inconsistently specified. Suppose the following setup:

  • repo/
    • node_modules/
    • src/
      • resources/
        • cat.png
      • test/
        • my.config.js
        • my.test.spec.js

Suppose within my.config.js, I set rootPath: '../../ - that is, to the parent directory of both src and node_modules.

If I run web-test-runner --config my.config.js with the cwd (current working directory) = test/, the rootPath is based at repo/. I can then request /src/cat.png to fetch my resource.

If I instead run the same command with cwd = src/, the rootPath is now the parent folder of repo/, and the server's paths are now different: I have to request /repo/src/cat.png to get the same resource.

Note that there are no changes made to my.config.js - the only change is the current working directory when I run the web-test-runner command.

Current version: "@web/test-runner": "0.18.1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant