5

I would like to be able to run a subset of it's or describe's in a Jasmine test file using jest with some type of tagging system.

I know I can indicate a filter of sorts by using a word after the keyword jest in the command line. For example, running `jest dashboard' when there are 2 test files, 'dashboard.api.spec.js' and 'navigation.api.spec.js', will only run the tests in 'dashboard.api.spec.js'. But what if I have a subset of dashboard tests in 'dashboard.api.spec.js' that I consider smoke tests that I want to be able to pinpoint to run?

I've seen the documentation on 'fit' and 'fdescribe', but that requires the user to modify the source code. I'd prefer to be able to say something like jest --tags='smoke'. I found something similar on the jest github: Issue 2846, but it seems it was shot down in August 2017.

Is there another module or way to configure jest short of making multiple files with different subsets of tests that would fit what I'm trying to accomplish?

2

In true javascript style , the support for this is delayed because of switch to another underlying library , in this case jasmine.

There is a -t option here (or --testNamePattern ) which takes a regex that matches on the text. If you ran jest -t dashboard you might have more luck. https://facebook.github.io/jest/docs/en/cli.html#testnamepattern-regex

| improve this answer | |
  • As projects do, I ended up not using jest, so this question has become a bit moot. I can't test to say if it works, but it definitely fits the spirit of my question as it matches on partials and one could write questions with the name "smoke" in them to work with this flag. Thanks! – S.Huston Jan 4 '18 at 20:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.