Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@swc/jest

Package Overview
Dependencies
Maintainers
2
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swc/jest

swc integration for jest

  • 0.2.37
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.2M
decreased by-14.92%
Maintainers
2
Weekly downloads
 
Created

What is @swc/jest?

The @swc/jest package is a Jest transformer using swc, designed to enable fast JavaScript transformations in Jest tests by leveraging the speed of swc. It allows users to compile their JavaScript and TypeScript code using swc within their Jest testing environment, providing a faster alternative to Babel.

What are @swc/jest's main functionalities?

JavaScript/TypeScript Compilation

This feature allows you to compile JavaScript and TypeScript files using swc within Jest. The code sample shows how to configure Jest to use @swc/jest for transforming files that match the regex pattern, enabling the use of modern JavaScript features and TypeScript in your tests.

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

Source Maps Support

Enables source maps for easier debugging of tests. When an error occurs, Jest will show the original code location instead of the transformed code location, making it easier to pinpoint issues.

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

Custom SWC Configuration

Allows for custom swc configuration directly within the Jest configuration. This example demonstrates enabling TypeScript syntax with decorators and setting the React transform runtime to 'automatic'.

module.exports = {
  transform: {
    '^.+\.(t|j)sx?$': ['@swc/jest', {
      jsc: {
        parser: {
          syntax: 'typescript',
          decorators: true
        },
        transform: {
          react: {
            runtime: 'automatic'
          }
        }
      }
    }]
  }
};

Other packages similar to @swc/jest

FAQs

Package last updated on 30 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc