-
-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
INSTA_WORKSPACE_ROOT
should also work with assert_snapshot!
at runtime, for manual test binaries
#575
Comments
Oh, apparently I need both rust_test(
name = 'qq-cli-tests',
srcs = glob(['**/*.rs']),
deps = COMMON_DEPS,
env = {
'CARGO_MANIFEST_DIR': '.',
'INSTA_WORKSPACE_ROOT': '.',
}
) |
Thanks for the issue. If we checked |
Now a single place where `INSTA_WORKSPACE_ROOT` & `CARGO_MANIFEST_DIR` are checked, with priority to the former. Fixes mitsuhiko#575 Could do with an integration test
Should be fixed by #614, feel free to test on that branch And @thoughtpolice if I'm misunderstanding how you're using this, please lmk |
I am evaluating insta with a project that uses Buck2 (and also a very happy user using it with Cargo as part of Jujutsu). When using a project with Buck2, Cargo is not used, and so tests for example are run "manually" by the build system itself after compilation with
--cfg=test
Currently, I'm using inline snapshots, with a test like this:
By default, when I compile this with
buck2 build
, I get an error like so:Buck2 executes all tests from the root of the project, so luckily I can set
CARGO_MANIFEST_DIR=.
during the compilation of these tests which solves the problem. But it's a bit ugly I think.While using Code Search to browse the source code to figure out how the macro worked, it looks like
INSTA_WORKSPACE_ROOT
also has a similar function. It would at least be more explanatory when I writeINSTA_WORKSPACE_ROOT=.
in the source code why it exists. However, it seems like it only works when you usecargo insta
.Alternatively, some other more general form or utility for
assert_snapshot!()
to work in the presence of non-Cargo systems would be nice.The text was updated successfully, but these errors were encountered: