You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We want to support custom snapshot feature to our test, and we need a way to control whether we in test mode or in update mode.
There are currently three ways to implement this.
implement a custom command like cargo insta
control it by environment like UPDATE to control whether we are in test mode or in update mode
disable harness and convert all test to main function to run test
They are both not the idea way, and we want something like jest or mocha.
$ jest // test mode
$ jest --updateSnapshot // update mode
$ mocha // test mode
$ mocha --update // update mode
if cargo test could support passing custom arguments to test, we could do it like jest
$ cargo test // test mode
$ cargo test --update // update mode
Proposed Solution
support passing custom arguments to cargo test, maybe we need a configuration for this feature.
Notes
someone also met same problem but not got a ideal answer
The text was updated successfully, but these errors were encountered:
hardfist
added
the
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
label
Nov 5, 2022
There are some issues that I would be concerned about with extensible flags:
I think it would be difficult to be able to convey "custom flags" to tell Cargo to parse. Additionally, I'm not even sure that is a good thing, as I think having a standard experience for which flags are valid is good for consistency and avoiding confusion.
libtest similarly has the same issue, where it won't know what flags your test is interested in, and which ones it should be parsing.
I understand this is a fairly common use case, so it might be nice to have something to make it easier. I think the cargo insta approach isn't too bad, and I'm curious what makes it seem not ideal. Environment variables I think are a common approach, and I'm also curious what makes them seem not ideal. I can make some guesses, but I'd like to hear more about what's wrong with the current approaches, and if there are other alternatives that would make them easier or more palatable.
Problem
We want to support custom snapshot feature to our test, and we need a way to control whether we in test mode or in update mode.
There are currently three ways to implement this.
They are both not the idea way, and we want something like jest or mocha.
if cargo test could support passing custom arguments to test, we could do it like jest
Proposed Solution
support passing custom arguments to cargo test, maybe we need a configuration for this feature.
Notes
someone also met same problem but not got a ideal answer
The text was updated successfully, but these errors were encountered: