Socket
Socket
Sign inDemoInstall

jest-transform-stub

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jest-transform-stub

Jest transform stub


Version published
Weekly downloads
697K
decreased by-2.78%
Maintainers
1
Install size
3.45 kB
Created
Weekly downloads
 

Readme

Source

jest-transform-stub

Jest doesn't handle non JavaScript assets by default.

You can use this module to avoid errors when importing non JavaScript assets.

Usage

npm install --save-dev jest-transform-stub

In your Jest config, add jest-transform-stub to transform non JavaScript assets you want to stub:

{
  "jest": {
    // ..
    "transform": {
      "^.+\\.js$": "babel-jest",
      ".+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$": "jest-transform-stub"
    }
  }
}

FAQ

My module isn't being transformed

Jest doesn't apply transforms to node_modules by default. You can solve this by using moduleNameMapper:

{
  "jest": {
    // ..
    "moduleNameMapper": {
      "^.+.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$": "jest-transform-stub"
    }
  }
}

Keywords

FAQs

Last updated on 03 Feb 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc