Software Alternatives & Reviews

Setup Jest to React Typescript Vite project, also SWC (part 1)

Vite Vercel Parcel Next.js jsdom Babel
  1. 1
    Next Generation Frontend Tooling
    Pricing:
    • Open Source
    Web applications are becoming an indispensable part of our lives. We can build literally everything on the web app nowadays from reading the news, composing email, learning, to video conferences, even gaming. Going hand in hand with that development is the growth in complexity and the unpredictable quality of web applications. Speaking of web application, Create React App (CRA) used to be the first choice when it comes to bootstrapping a React application and it fulfilled its duty. Now CRA is in maintenance mode and the ecosystem gives us a lot of good tools to start a React project like Vite, Parcel, NextJS... I had a chance to use Vite in my daily work and I’m very happy with that, my Developer Experience (DX) and productivity have increased dramatically, it’s blazing fast. However, speed is not the only factor to make a high quality web application. We also need tests. Even though I’m happy with Vite, it took me a while to successfully integrate Jest with Vite. In this post, I am going to setup Jest to a React Typescript Vite project (spoiler alert: swc).

    #Software Development #Web Frameworks #Developer Tools 381 social mentions

  2. 2
    Vercel is the platform for frontend developers, providing the speed and reliability innovators need to create at the moment of inspiration.
    So, Vite takes advantage of ESM, on the other hand, Jest uses CommonJS (it actually has experiment support for Native ESM but it’s not 100% ready now - March of 2022). That’s the reason why you see the error message as above when using import and export. So we have a few options here: 1. Use Jest experiment support for ESM 2. Use babel to compile ESM to CommonJS (similar to what CRA does) 3. Use high performance build tools like esbuild and SWC: a. esbuild: created by Evan Wallace, co-founder of figma. Esbuild is written in Go and it is one of core components for the speed of Vite. b. SWC: created by Donny (강동윤), a young talent developer from Vercel. SWC stands for Speedy Web Compiler and is written in Rust. SWC is adopted by Vercel and replaced babel to be the compiler of NextJS since version 12.

    #Developer Tools #Web Development Tools #App Deployment 527 social mentions

  3. 3
    Blazing fast, zero configuration web application bundler
    Pricing:
    • Open Source
    Web applications are becoming an indispensable part of our lives. We can build literally everything on the web app nowadays from reading the news, composing email, learning, to video conferences, even gaming. Going hand in hand with that development is the growth in complexity and the unpredictable quality of web applications. Speaking of web application, Create React App (CRA) used to be the first choice when it comes to bootstrapping a React application and it fulfilled its duty. Now CRA is in maintenance mode and the ecosystem gives us a lot of good tools to start a React project like Vite, Parcel, NextJS... I had a chance to use Vite in my daily work and I’m very happy with that, my Developer Experience (DX) and productivity have increased dramatically, it’s blazing fast. However, speed is not the only factor to make a high quality web application. We also need tests. Even though I’m happy with Vite, it took me a while to successfully integrate Jest with Vite. In this post, I am going to setup Jest to a React Typescript Vite project (spoiler alert: swc).

    #Web Application Bundler #Assets Bundler #JS Build Tools 102 social mentions

  4. A small framework for server-rendered universal JavaScript apps
    Pricing:
    • Open Source
    Web applications are becoming an indispensable part of our lives. We can build literally everything on the web app nowadays from reading the news, composing email, learning, to video conferences, even gaming. Going hand in hand with that development is the growth in complexity and the unpredictable quality of web applications. Speaking of web application, Create React App (CRA) used to be the first choice when it comes to bootstrapping a React application and it fulfilled its duty. Now CRA is in maintenance mode and the ecosystem gives us a lot of good tools to start a React project like Vite, Parcel, NextJS... I had a chance to use Vite in my daily work and I’m very happy with that, my Developer Experience (DX) and productivity have increased dramatically, it’s blazing fast. However, speed is not the only factor to make a high quality web application. We also need tests. Even though I’m happy with Vite, it took me a while to successfully integrate Jest with Vite. In this post, I am going to setup Jest to a React Typescript Vite project (spoiler alert: swc).

    #Developer Tools #Web Frameworks #JavaScript Framework 924 social mentions

  5. 5
    A JavaScript implementation of various web standards, for use with Node.js - jsdom/jsdom
    Pricing:
    • Open Source
    Everything you want to do to your test environment such as extends the jest matchers with @testing-library/jest-dom, mock some APIs that’s not implemented in jdom, you can put to config/jest/setupTests.js:.

    #Development #Automated Testing #Browser Testing 28 social mentions

  6. 6
    Babel is a compiler for writing next generation JavaScript.
    Pricing:
    • Open Source
    So, Vite takes advantage of ESM, on the other hand, Jest uses CommonJS (it actually has experiment support for Native ESM but it’s not 100% ready now - March of 2022). That’s the reason why you see the error message as above when using import and export. So we have a few options here: 1. Use Jest experiment support for ESM 2. Use babel to compile ESM to CommonJS (similar to what CRA does) 3. Use high performance build tools like esbuild and SWC: a. esbuild: created by Evan Wallace, co-founder of figma. Esbuild is written in Go and it is one of core components for the speed of Vite. b. SWC: created by Donny (강동윤), a young talent developer from Vercel. SWC stands for Speedy Web Compiler and is written in Rust. SWC is adopted by Vercel and replaced babel to be the compiler of NextJS since version 12.

    #Development Tools #Javascript UI Libraries #JavaScript Framework 134 social mentions

Discuss: Setup Jest to React Typescript Vite project, also SWC (part 1)

Log in or Post with