The Wayback Machine - https://web.archive.org/web/20220627175315/https://github.com/netlify/netlify-cms/discussions/6298
Skip to content

Add instruction for running a specific test from a specific file #6298

bytrangle started this conversation in Ideas
Add instruction for running a specific test from a specific file #6298
Mar 14, 2022 · 1 comment

bytrangle
Mar 14, 2022
Collaborator

Sorry if this hasn't been mentioned in the Contributing guideline.

Sometimes, a few code changes one made leads to some unit tests, or test suits to fail. AFAIK, you can run a specific file with this command:

yarn jest FILENAME

For example: yarn jest gitlab.spec.js to run all the tests inside the gitlab.spec.js file.

You can also run a specific test inside a file by adding the flag --testNamePattern.

yarn jest --testNamePattern "stores" gitlab.spec.js

The command above will run the test that contains the word "storesin thegitlab.spec.js`.

I understand that this is peculiar to Jest and not in the domain of Netlify CMS, so I wonder if we should add the tip above to the Contributing guideline? Until a few days ago, I didn't know any better and troubleshoot one failed file, then ran yarn test and waited for all of them to finish 😨.

Replies

@bytrangle, this is a great idea! Please do add it 🚀

0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants