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

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin