grommet / grommet-cli

Deprecated, use create-react-app for v2 instead. Command Line interface for grommet
Apache License 2.0
28 stars 18 forks source link

pass through jest command line config #41

Open c-vetter opened 7 years ago

c-vetter commented 7 years ago

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 commented 7 years ago

Yeah you can now run grommet check and all options will be kept

grommet check -t -- --updateSnapshot‘ grommet check -t -- --watch‘

Hope it helps

Kr Alan

On Jul 30, 2017, at 6:04 AM, rasenplanscher notifications@github.com wrote:

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 :)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

c-vetter commented 7 years ago

Thanks for the quick reply!

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

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 commented 7 years ago

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 commented 7 years ago

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 commented 6 years ago

@alansouzati did this get added to Jest?