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

pass through jest command line config #41

Open
c-vetter opened this issue Jul 30, 2017 · 5 comments
Open

pass through jest command line config #41

c-vetter opened this issue Jul 30, 2017 · 5 comments

Comments

@c-vetter
Copy link
Contributor

Just now, running yarn test gave me this:

 › 1 obsolete snapshot found, run with `yarn test -- -u` to remove them.

Then, yarn test -- -u gave me this:

grommet check -u

  Invalid option: 'u'. Showing Help:

  Usage: check [options]

  Runs Javascript/SASS linters and execute tests for your project

  Options:

    --help          output usage information
    -j, --jslint    Whether to run only js lint.
    -s, --scsslint  Whether to run only scss lint.
    -t, --test      Whether to run only tests.

It would be great if jest's advice held true :)

@alansouzati
Copy link
Contributor

alansouzati commented Jul 30, 2017 via email

@c-vetter
Copy link
Contributor Author

Thanks for the quick reply!

grommet check -t -- --updateSnapshot does do that, yes. So, I have several options to update the snapshots:

  • with grommet-cli installed globally, run grommet check -t -- --updateSnapshot
  • setup an npm script for that
  • change the test script to grommet check -- so that parameters to yarn test are used as extras for grommet

Unfortunately, grommet-cli seems to ignore -u as an extra parameter. Therefore, I'd need to use the long form. Consequently, the console output will still point me in the wrong direction, for each setup. That divide can be handled through documentation and such, but I really don't believe that's the most user-friendly way to go since each developer has cognitive overload from actively ignoring part of the console output.

Also, your mention of the watch parameter had me thinking, why not add -u and --watch? Possibly as first-order parameters 🤔 A lint watcher would be nice... What do you think?

@c-vetter
Copy link
Contributor Author

Then again, we couldn't use Jest's watch mode while simultaneously running something else... Therefore, the watch mode would need to trigger jest as well per change...

@alansouzati
Copy link
Contributor

we used to have -u only. But I guess it would be too much of an overhead to replicate and maintain all the other CLI parameters in our CLI. That's why I removed the -u in the 5.0 release.

In the past jest used to support both -u and -w as a shortcut to run things. It does not seem to be present in version 20 though. This just enforces the fact that it is cumbersome to replicate the attributes.

That said, I like your idea of having a few first-order parameters like watch and update. They can actually be reused in both eslint and jest.

grommet check -t -w => runs test in watch mode
grommet check -j -w => runs eslint in watch mode

grommet check -t -u => runs test and updates snapshots
grommet check -j -u => runs eslint with fix option so, if possible, lint issues will be automatically fixed

I will try to add support for that soon. Thanks for bringing this up.

@L0ZZI
Copy link

L0ZZI commented Feb 1, 2018

@alansouzati did this get added to Jest?

@L0ZZI L0ZZI added waiting and removed waiting labels Feb 1, 2018
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

3 participants