Open cafkafk opened 4 months ago
I assume you are reporting this against trycmd
?
Do you have a minimal reproduction case I can work with for identifying the root cause?
I assume you are reporting this against trycmd?
Yup, I think that's reasonable consider the only change was the version bump leading to a breakage, if I need to move this issue lmk, I don't understand the snapbox internals >_>
Do you have a minimal reproduction case I can work with for identifying the root cause?
The problem is our tests rely on some nix sandboxing assumptions, and tests will completely break without having a nix environment. Entering the repository, typing nix develop
, and running the just recipe just itest
would maybe be the easiest, but again this does require having nix installed.
I know that's pretty convoluted, I'm sorry I don't have a simpler way to do this. It may be possible to do it without nix by manipulating timestamps, but there may be other behavior that also breaks in strange ways.
The challenge I'm having is I can't see why this is failing and without any context, the new output seems more correct. If /build/source
was the CWD for the tests being run, I believe that substitution should have been happening.
I went back and audited this. All that changed in these versions was internals as we changed the underlying snapbox
package. For reference, the command I ran was
$ git diff 72241ddc76e3ffbbb86e84e370492ea3c03d11cd -- .
(see also https://github.com/assert-rs/snapbox/compare/v0.15.2...trycmd-v0.15.4)
The actual issue that has occurred seems to be that /build/source
isn't replaced with [CWD]
when generated in the Nix sandbox, but when someone runs tests without being inside of the sandbox, i.e. normal cargo test in the repo, [CWD]
is substituted seemingly correctly.
Perhaps the current working directory of the sandbox was root? Does that not get substituted for [CWD]
?
I can't explicitly find something in the version bump that should be the culprit either, although it is odd it started appearing after. Right now my workaround is doing fd -e stdout -e stderr -H -t file tests
.
Regarding the handling of [CWD]
, the most relevant changes I see are
output.replace(current_dir.display(), "[CWD]")
to output.replace(current_dir.display(), "[CWD]").replace(current_dir.display().replace('\\', '/'), "[CWD]")
See https://github.com/eza-community/eza/pull/1005
For testing, normally, we run tests with
just itest
inside of our repo, which requires nix.Example of breakage: