adamgruber / mochawesome

A Gorgeous HTML/CSS Reporter for Mocha.js
https://gitter.im/mochawesome/general
MIT License
1.06k stars 160 forks source link

Running mochawesome from root can mangle testsuite `file` property #394

Open gofr opened 1 year ago

gofr commented 1 year ago

I run tests in a docker container, from the root directory. That means the current working directory is /.

That makes this line potentially nonsensical: https://github.com/adamgruber/mochawesome/blob/963f073fe3f4522070788a702329dd6b61014df3/src/utils.js#L233

That file path isn't necessarily an absolute file path. In my case it just strips the first slash in an already relative path. So a test path like my/relative/path/to/test.js becomes myrelative/path/to/test.js, which doesn't exist.

It should probably only strip the CWD if it's at the start of the file path?