All Projects → swc-project → jest

swc-project / jest

Licence: MIT license
Super-fast alternative for babel-jest or ts-jest without type checking

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to jest

rescript-jest
ReScript bindings for Jest
Stars: ✭ 274 (-41.95%)
Mutual labels:  jest
generator-node
🔧 Yeoman generator for Node projects.
Stars: ✭ 16 (-96.61%)
Mutual labels:  jest
jest-extended-snapshot
Additional Jest matchers for snapshot testing.
Stars: ✭ 18 (-96.19%)
Mutual labels:  jest
nimbus
Centralized CLI for JavaScript and TypeScript developer tools.
Stars: ✭ 112 (-76.27%)
Mutual labels:  jest
node-js-starter-kit
This is the starter kit project for node js REST API development with express js, mongodb, typescript, webpack specially designed for REST API projects.
Stars: ✭ 14 (-97.03%)
Mutual labels:  jest
jest-playground
Playing around with Jest - Subscribe to my YouTube channel: https://bit.ly/CognitiveSurge
Stars: ✭ 24 (-94.92%)
Mutual labels:  jest
Express-REST-API-Template
Minimal starter project for a Node.js RESTful API based off express generator
Stars: ✭ 26 (-94.49%)
Mutual labels:  jest
energy-use-case-trading-client
Energy Use Case Web UI for Lition Trading Platform
Stars: ✭ 23 (-95.13%)
Mutual labels:  jest
rollup-jest-boilerplate
🎉 Full featured boilerplate for building JavaScript libraries the modern way
Stars: ✭ 81 (-82.84%)
Mutual labels:  jest
firestore-jest-mock
Jest Helper library for mocking Cloud Firestore
Stars: ✭ 128 (-72.88%)
Mutual labels:  jest
jest-snapshot-talk
React Conf 2017: Jest, Snapshots and Beyond
Stars: ✭ 48 (-89.83%)
Mutual labels:  jest
gobarber-api-gostack11
API GoBarber / NodeJS / Express / Typescript / SOLID
Stars: ✭ 39 (-91.74%)
Mutual labels:  jest
web-extension-boilerplate
The web extension boilerplate help to set up project quickly using typescript, jest, webpack, githook, prettier and github actions
Stars: ✭ 35 (-92.58%)
Mutual labels:  jest
express-typeorm-rest-boilerplate
Boilerplate code to get started with building RESTful API Services (Express, TypeORM MongoDB stack)
Stars: ✭ 53 (-88.77%)
Mutual labels:  jest
gobarber-app
💈A BarberShop app made with React, React Native and Node.
Stars: ✭ 34 (-92.8%)
Mutual labels:  jest
webpack
Готовая сборка webpack
Stars: ✭ 21 (-95.55%)
Mutual labels:  jest
fly-helper
It's a Tool library, method collection
Stars: ✭ 21 (-95.55%)
Mutual labels:  jest
rollup-plugin-swc
Rollup plugin to compile bundles with the SWC.
Stars: ✭ 59 (-87.5%)
Mutual labels:  swc
xstate-marionettist
Model based testing with Jest, XState and Puppeteer or Playwright made easy
Stars: ✭ 23 (-95.13%)
Mutual labels:  jest
Splain
small parser to create more interesting language/sentences
Stars: ✭ 15 (-96.82%)
Mutual labels:  jest

@swc/jest

SWC binding for Jest.

Installation

# if you use npm
npm i -D jest @swc/core @swc/jest
# if you use yarn
yarn add -D jest @swc/core @swc/jest

Usage

jest.config.js:

module.exports = {
  transform: {
    '^.+\\.(t|j)sx?$': '@swc/jest',
  },
}

It will load the SWC configuration from .swcrc by default. You also can customize it:

const fs = require('fs')

const config = JSON.parse(fs.readFileSync(`${__dirname}/.swcrc`, 'utf-8'))

module.exports = {
  transform: {
    '^.+\\.(t|j)sx?$': ['@swc/jest', { ...config, /* custom configuration in Jest */ }],
  },
}

Q & A

Q: Jest uses CommonJS by default. But I want to use ESM.

A: Setup Jest following this Guide.

For JavaScript, edit package.json as follows:

{
  // ...
  "type": "module"
}

For TypeScript, edit jest.config.js as follows:

module.exports = {
  // ...
  extensionsToTreatAsEsm: ['.ts', '.tsx'],
}

Run test with --experimental-vm-modules:

cross-env NODE_OPTIONS=--experimental-vm-modules jest

# or
node --experimental-vm-modules ./node_modules/jest/bin/jest.js

Q: What ECMAScript target is set by jsc.target?

A: By default, the version supported by your Node runtime.

Node version Default jsc.target
12 'es2018'
13 'es2019'
14 'es2020'
15 'es2021'
16 'es2021'
17 'es2022'

You can customize this by setting an explicit version in jest.config.js:

module.exports = {
    transform: {
        "^.+\\.(t|j)sx?$": [
            "@swc/jest",
            {
                jsc: {
                    target: "es2021",
                },
            },
        ],
    },
}

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].