Skip to content
This repository has been archived by the owner on Jun 7, 2020. It is now read-only.

Create CLI #1

Open
anp opened this issue Jul 11, 2017 · 2 comments
Open

Create CLI #1

anp opened this issue Jul 11, 2017 · 2 comments

Comments

@anp
Copy link
Owner

anp commented Jul 11, 2017

This CLI should:

  1. run snapshot tests in order
  2. show interactive prompt at each failing test with test output diff and asking user whether to update
  3. run any "marked for update" tests with UPDATE_SNAPSHOTS env var set
  4. warn about any snap files on disk which don't correspond to tests ran during step 1
@RadicalZephyr
Copy link
Contributor

FWIW I personally would not use the interactive CLI. I would want to be able to simply update all snapshots. The workflow I'm thinking I would use is something like:

  • start from a clean version control revision
  • update all snapshots with CLI tool
  • use my version control diffing tools to see which tests have changed and how
  • use my version control tools to discard changes to files that I don't want.
  • commit

Another note about this is that it would be nicer in this paradigm for the files containing the test output to be only the result of the test. I'm kind of curious about that design decision btw. It seems to me that it would be simpler to encode the full rust module path to the test snapshot in the file path that holds the snapshot content. So for instance the file path to the test example in your blog post would change like:

-PATH_OF_TEST_FILE/__snapshots__/FILENAME_OF_TEST_FILE.snap
+PATH_OF_TEST_FILE/__snapshots__/FILENAME_OF_TEST_FILE/simple/test/simple_snapshot.snap`

Thoughts?

@anp
Copy link
Owner Author

anp commented Dec 5, 2018

use my version control tools to discard changes to files that I don't want.

My personal experience is that development tools are nicest to use when they minimize their assumptions about other tools in the environment. That said it's not like I have a lot of time for this at the moment!

It seems to me that it would be simpler to encode the full rust module path to the test snapshot in the file path that holds the snapshot content.

I believe this was an outcome of being in a rush and considering this experimental. PRs very welcome!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants