1. @sucrase/jest-plugin
Jest plugin for Sucrase
@sucrase/jest-plugin
Package: @sucrase/jest-plugin
Created by: alangpierce
Last modified: Sat, 08 Oct 2022 07:58:58 GMT
Version: 3.0.0
License: MIT
Downloads: 105,843
Repository: https://github.com/alangpierce/sucrase/blob/main/integrations

Install

npm install @sucrase/jest-plugin
yarn add @sucrase/jest-plugin

Sucrase Jest plugin

npm version
MIT License

This is a simple Jest plugin that makes it easy to use
Sucrase when running Jest tests.

Usage

First install the package and sucrase as a dev dependency:

yarn add --dev @sucrase/jest-plugin sucrase

Then change the default transform in jest.config.js file:

   ...
  transform: { "\\.(js|jsx|ts|tsx)$": "@sucrase/jest-plugin" },
  ...

You can specify additional transformation options to Sucrase by passing an object. For example, to enable automatic react transforms:

   ...
  transform: { "\\.(js|jsx|ts|tsx)$": ["@sucrase/jest-plugin", { jsxRuntime: 'automatic' }] },
  ...

By default, the transforms option is automatically detected based on file type and Jest mode.
If you pass a transforms array in the options, it will apply to all files, regardless of extension.

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code