TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Jest is so slow. Why Jest?

6 点作者 artemave超过 4 年前
I&#x27;ve been running some performance comparison of different JavaScript test runners [1]. Jest comes out woefully behind everything else. To me personally that&#x27;s a show stopper. However, Jest is popular and so I am clearly missing something. Looking through Github issues, it&#x27;s also clear that addressing performance is not a priority. What is the priority? Who is Jest appealing to?<p>I&#x27;d really love to hear from people who, given a green light on tech choices, would pick Jest over, say, mocha or tape for their next project. Thank you!<p>[1] https:&#x2F;&#x2F;github.com&#x2F;artemave&#x2F;node-test-runners-benchmark

4 条评论

scraggo超过 4 年前
I did a comparison of Ava, Mocha, and Jest test runners: <a href="https:&#x2F;&#x2F;github.com&#x2F;scraggo&#x2F;comparing-javascript-test-runners" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;scraggo&#x2F;comparing-javascript-test-runners</a><p>Jest is the slowest if running tests in parallel with Mocha &gt;=8. Mocha is the slowest in its default serial mode.<p>My conclusion with Jest was this:<p>&quot;Jest is recommended if you want to get tests up and running quickly. It has everything built in and requires very little configuration. The command line and GUI experience is unmatched. Finally, it&#x27;s the most popular and makes an excellent pair with React.&quot;
danieka超过 4 年前
Huh, we&#x27;re using Jest with Vue and Typescript, and I&#x27;ve always assumed that Vue setup and Typescript transpilation were the heavy parts. We have far fewer tests than I&#x27;d like, and still the tests suite takes more than a minute to run.<p>First thing tomorrow I&#x27;m looking into other test runners. Thank you for sharing this!
leipert超过 4 年前
I think jest uses a JSDOM environment per default in order to stimulate certain APIs.<p>Might be sensible to compare the node environment to the others if you do not need browser APIs in your tests. And this might be the reason for picking it, frameworks just working g out of the Box.<p>Personally it doesn’t matter too much as we have too many tests to run all of them locally all the time anyhow.
评论 #25577170 未加载
artemave超过 4 年前
Clickable link from the submission <a href="https:&#x2F;&#x2F;github.com&#x2F;artemave&#x2F;node-test-runners-benchmark" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;artemave&#x2F;node-test-runners-benchmark</a>