Git Product home page Git Product logo

Comments (8)

kaushalyap avatar kaushalyap commented on May 20, 2024

Official Nextjs example code : https://github.com/vercel/next.js/tree/canary/examples/with-vitest

from next-js-boilerplate.

ixartz avatar ixartz commented on May 20, 2024

Why Vitest?

Next.js has a built-in configuration for Jest, which is not the case with Vitest if not wrong?

I can understand we can use Vitest with Vite but Next.js is not build on top of Vite. Love to hear any feedback and suggestion.

What bring Vitest compared to Jest?

from next-js-boilerplate.

kaushalyap avatar kaushalyap commented on May 20, 2024

https://vitest.dev/guide/comparisons.html#jest

Mainly for performance reasons, faster test suits means faster feedback loop which means improved DX.

There will be official Vite support in Nextjs probably when they reached 1.0

from next-js-boilerplate.

ixartz avatar ixartz commented on May 20, 2024

The default configuration provided by Next.js for Jest use @swc/jest behind the scene, should provide a good performance.

Based on some reddit post, Vitest is even slower: https://www.reddit.com/r/reactjs/comments/1066fvv/test_runner_spa_vite_react_vitest_vs_jestswc/?rdt=41518

from next-js-boilerplate.

ixartz avatar ixartz commented on May 20, 2024

Here is another post about the performance: https://www.jameslmilner.com/posts/speeding-up-typescript-jest-tests/

from next-js-boilerplate.

kaushalyap avatar kaushalyap commented on May 20, 2024

The default configuration provided by Next.js for Jest use @swc/jest behind the scene, should provide a good performance.

You may be probably right, sorry I did not considered the SWC,

Most recent bench mark without SWC integration shows it is just marginally faster, probably new Turbo pack will improve the test performance more with Jest or bring a testing capabilities like Bun.

So I'll close this issue!

from next-js-boilerplate.

ixartz avatar ixartz commented on May 20, 2024

@kaushalyap Thank you for your suggestion, always open to feedback and suggestion.

I would totally reconsider Vitest in the future, very promising.

from next-js-boilerplate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.