jest: ddescribe and iit do not work

Somehow I cannot pick one test only anymore. Jest always scans for all tests and runs them all. Adding one ddescribe() in one of them has no impact.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 24 (14 by maintainers)

Most upvoted comments

I think it is possible. ava also runs tests in parallel and its test.only() is working as expected (only those tests are ran across all test files)

I think you’re looking for it.only() and describe.only()?

So, the main problem here is parallel execution, right? What about –runInBand then? Can we fix the problem at least for non-parallel runInBand mode?

For Node.js testing, just moved over to try Jest as opposed to my former go-to test dependencies (Mocha, Chai, Proxyquire and Sinon) - the idea of consolidating to just having to use Jest was a primary motiviation, together with Mock by default behaviour… really liked the idea of cutting down on the test harness plumbing. So far the experience using Jest has been really disappointing for reasons (one of many) such as this - too many workarounds and sub-optimal hacks to get equivalent behaviour that is expected to be out of the box. In fact, using Jest has resulted in more plumbing, not less - and less options / power. Using Mocha, Chai, Proxyquire and Sinon is not ideal either (hence the Jest trial). Shame that a lot of the promise for Jest has not (yet) been realised - frustratingly close to what I was looking for - shall take another look in 6-12 months as I still think the library may one day get there.

@danielstern you can now use -i -t <pattern> I guess.

My 2 cents: afaics it.only works, but in the related describe block (meaning if you have many test files they still run). What I would expect instead is that from all the test files, only the one marked as it.only is run.

PS: the repo looks quite dead (over 2 years ago) https://github.com/davemo/jasmine-only