Test Runner config rootPath is resolved relative to cwd, not the path of the config
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
- resources/
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"