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

@stylable/jest

Package Overview
Dependencies
Maintainers
6
Versions
226
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stylable/jest

Test your Stylable React components using Jest

  • 6.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.4K
increased by78.9%
Maintainers
6
Weekly downloads
 
Created
Source

@stylable/jest

npm version

@stylable/jest is a simple integration that allows testing your Stylable React components using Jest.

Installation

Install @stylable/jest as a dev dependency in your local project.

Install using npm:

npm install @stylable/jest --save-dev

Install using yarn:

yarn add @stylable/jest --dev

Usage

Add the transformer to your jest.config.js file:

module.exports = {
  transform: {
    '\\.st\\.css?$': '@stylable/jest',
  }
};

Configuring Stylable options

See the interface for StylableConfig here.

module.exports = {
  transform: {
    '\\.st\\.css?$': ['@stylable/jest', { stylable: { /* Stylable options */ } }],
  }
};

Ignore Stylable files from exsiting css integrations

To prevent existing CSS integrations from affecting Stylable files, ignore '.st.css' in the integration configuration.

Change:

"moduleNameMapper": {
  "\\.(css|scss)$": "SOME_MOCK_PATH"
},

To:

"moduleNameMapper": {
  "(?<!\\.st)\\.(css|scss)$": "SOME_MOCK_PATH"
},

Ignoring node_modules stylesheets

To disable transformation for stylehseets originating from your node_modules add the following configuration:

module.exports = {
  // existing configuration...
  
  transformIgnorePatterns: [
    '/node_modules/(?!(.*?\\.st\\.css$))', // libraries publish .st.css files in their dist
  ],
};

License

Copyright (c) 2017 Wix.com Ltd. All Rights Reserved. Use of this source code is governed by a MIT license.

FAQs

Package last updated on 30 May 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