Are tests inside one file run in parallel in Jest?

后端 未结 3 1454
谎友^
谎友^ 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:17

    Yes, you can safely assume tests inside a single file will run in the order of appearance. You could prove this by putting a console.log in each it block.

    It's probably worth mentioning that it's generally bad practice to rely on the order of execution / external state...and you never know, Jest (or the current underlying test runner, Jasmine) may decide to run them in a random order in a newer version.

提交回复
热议问题