🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@anansi/jest-preset

Package Overview
Dependencies
Maintainers
1
Versions
158
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@anansi/jest-preset

Jest Preset for Anansi

0.11.18
latest
npm
Version published
Weekly downloads
30
-78.72%
Maintainers
1
Weekly downloads
 
Created
Source

🕷 Anansi Jest Preset

CircleCI npm downloads npm version PRs Welcome

Testing should just work

Usage

/jest.config.js
module.exports = {
  preset: "@anansi/jest-preset"
}

See @anansi/webpack-config for full list of module formats supported.

Motivation

Anansi's webpack automatically makes media files, svgs, scss/css modules, webworkers and TypeScript or babel work automatically. Using this preset enables all those module types to be handled in exactly as you'd expect with the webpack config.

ENV customization

Jest doesn't give much flexibility with regard to presets, so we provide some environmental variables to do customizations that impact multiple aspects of the configuration. However, this can also be done in a javascript jest config like so:

/jest.config.js
process.env.ANANSI_JEST_BABELCONFIG = 'babel.config.js';
process.env.ANANSI_JEST_TSCONFIG = 'tsconfig.test.json';

module.exports = {
  preset: '@anansi/jest-preset',
};

ANANSI_JEST_TSCONFIG = 'tsconfig.json'

It might be useful to have a specific tsconfig for tests that inherits from the base config. Use this variable to have jest pickup that file instead.

ANANSI_JEST_BABELCONFIG = true

By default jest will automatically search for the appropriate babel configuration (with the value of true). In case this doesn't work you can specify a string for the babel configuration.

Using 'babel.config.js' will automatically invoke the rootMode: 'upward' algorithm.

ANANSI_JEST_TYPECHECK = true

If set to 'false', this disables type checking which can reduce memory usage quite a bit.

This can be useful when running tests in multiple environments as the environment often doesn't impact typing, making re-checking types a waste of resources.

Keywords

jest

FAQs

Package last updated on 15 May 2025

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