Test fixture root is not correct for some tests
Opened this issue · 5 comments
When running make test
, the system will run ./src/bin/parser-test.rs. This tries to find the tests in FIXTURE_ROOT, but they are not present there. However, the tests in the gosub_html5 crate, do find these tests at the correct position, mainly because the FIXTURE_ROOT is a relative path.
We somehow must make this more consistent so we can run both make test
, and have the CI pass
Hello everyone!
First time here, I would like to work on this to get familiar with the project.
I think there are a couple ways this could be done reliably that I can think of.
- Change FIXTURE_ROOT variable to use
env!("CARGO_MANIFEST_DIR")
and concat the rest of the path - Find base project root (possibly the Cargo.lock) and use it as the base path and generate the FIXTURE_ROOT from there.
Both options seem reasonable. I would opt for the least amount of change for the enduser (so option 2),.. but having option 1 as a backup (so you can override if the system cannot find it for whatever reason) might be nice too.. I just don't know if that is a lot of work or not..
I'm just able to respond as I was away last week. Honestly the simplest change is the first one as it is basically changing the FIXTURE_ROOT variable.
Second one would be more robust way to do it but if we're not using it anywhere else I don't see the need to add the functionality.
I have created a PR with the second way but figured we should discuss the second way as well.
There is a crate called project_root that literally does that and it's the simplest crate ever that we can implement ourselves.
Project Root Crate
Using this function would be a more general approach imo because it goes straight for the base directory, checking Cargo.lock
I was reading the docs and I saw in the binaries docs parser-test, this issue is still listed. Should I remove it in this PR?