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.
The
rootPath
used by the server, which affects paths that need manually loading during tests, is inconsistently specified. Suppose the following setup:Suppose within
my.config.js
, I setrootPath: '../../
- that is, to the parent directory of bothsrc
andnode_modules
.If I run
web-test-runner --config my.config.js
with the cwd (current working directory) =test/
, the rootPath is based atrepo/
. I can then request/src/cat.png
to fetch my resource.If I instead run the same command with cwd =
src/
, therootPath
is now the parent folder ofrepo/
, 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 theweb-test-runner
command.Current version:
"@web/test-runner": "0.18.1"