Are tests inside one file run in parallel in Jest?

后端 未结 3 1458
谎友^
谎友^ 2021-02-01 13:47

Jest states in docs: \"Jest virtualizes JavaScript environments and runs tests in parallel across worker processes.\"

But what about multiple tests inside one file, do t

3条回答
  •  南笙
    南笙 (楼主)
    2021-02-01 14:09

    You can use test.concurrent('test run concurrently', () => { ... }) if you want to run them in parallel inside one file is too slow. It is a bit buggy and not well documented, but at least there's a way there.

    One thing I notice is it does not wait for async stuff in the beforeAll() so you need some of your own trick(like setInterval to wait) to make it work as expected.

提交回复
热议问题