Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@equisoft/jest-utils

Package Overview
Dependencies
Maintainers
13
Versions
314
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@equisoft/jest-utils

latest
npmnpm
Version
1.8.0
Version published
Maintainers
13
Created
Source

@equisoft/jest-utils

This package regroup utils to help write tests with Jest and create a standard config.

How to install

yarn add -DE @equisoft/jest-utils

How to use

Create a jest config

Create your jest.config.js file and import the createJestConfig function. The createJestConfig uses a deep merge that allow you to extend from the base Equisoft's config.

// jest.config.js

const { createJestConfig } = require('@equisoft/jest-utils');
const { pathsToModuleNameMapper } = require('ts-jest');
const { compilerOptions } = require('./tsconfig.json');

const config = {
    moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths || [], { prefix: '<rootDir>/src/test' }),

    roots: [
        '<rootDir>/src/browser',
        '<rootDir>/src/test',
    ],
    setupFilesAfterEnv: [
        'jest-extended',
        './src/test/setup-tests.ts',
    ],

    collectCoverageFrom: ['<rootDir>/src/browser/**/*.{js,jsx,ts,tsx}'],

    transform: {
        '^.+.m?[t]sx?$': ['ts-jest', {
            tsconfig: 'src/test/tsconfig.json',
            babelConfig: {
                presets: [
                    ['@babel/preset-env', { targets: { node: 'current' } }],
                    '@babel/preset-react',
                ],
                plugins: [
                    '@babel/plugin-transform-react-display-name',
                    ['babel-plugin-styled-components', { fileName: false }],
                ],
            },
        },
        ],
    },
};

module.exports = createJestConfig(config);

Extra configuration for GitHub Actions

Jest has a built-in support for GitHub Actions annotations (see Jest documentation). This feature is enabled by default when running on GitHub Actions. To disable this feature, you can set the JEST_ENABLE_ANNOTATIONS environment variable to false when running Jest.

FAQs

Package last updated on 19 Sep 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