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

@ggascoigne/jest-config

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ggascoigne/jest-config

A shareable jest configuration for projects.


Version published
Weekly downloads
1
decreased by-90.91%
Maintainers
0
Weekly downloads
 
Created
Source

Jest Config

My personal shareable jest configuration.

Install

pnpm add -D jest @ggascoigne/jest-config

Usage

jest.config.js

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

Extending

An example with testMatch that Jest uses to detect test files.

jest.config.js

module.exports = {
  preset: '@ggascoigne/jest-config',
  testMatch: [
    '<rootDir>/__tests__/**/**.+(ts|tsx|js|jsx)',
    '<rootDir>/src/**/?(*.)+(spec|test).+(ts|tsx|js|jsx)',
  ],
};

Add an NPM Script

Running this command:

npm set-script test "jest"

Will create:

package.json

"scripts": {
  "test": "jest"
},

Add a Pre-commit Hook

Note: Executes tests and coverage output related to files that have been changed in the current commit only.

lint-staged.config.js

module.exports = {
  '*.{js,jsx,ts,tsx}': [
    'pnpm test --bail --passWithNoTests --findRelatedTests --coverage',
  ],
};

Under The Hood

jest-preset.js

  • @types/jest
  • ts-jest
  • jest-environment-jsdom
  • jest-transform-stub

License

MIT

Keywords

FAQs

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