1.2.8 • Published 1 year ago

@jpapini/jest-config v1.2.8

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Jest configuration

Jest configuration and utilities for JavaScript and TypeScript projects.

How to use

  1. Install the package and its required peer dependencies:
pnpm add -D @jpapini/jest-config @swc/core @swc/jest jest @types/jest
  1. Create a jest.config.js file with the following content:

For ESM projects:

import { createRequire } from 'node:module';
import url from 'node:url';

import { createJestConfig, pathsToModuleNameMapper } from '@jpapini/jest-config';

const require = createRequire(import.meta.url);
const { compilerOptions } = require('./tsconfig.json');

export default createJestConfig({
    rootDir: url.fileURLToPath(new URL('.', import.meta.url)),
    moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/' }),
});

or for CJS projects:

const path = require('node:path');

const { createJestConfig, pathsToModuleNameMapper } = require('@jpapini/jest-config');

const { compilerOptions } = require('./tsconfig.json');

module.exports = createJestConfig({
    rootDir: path.resolve(__dirname),
    moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/' }),
});
  1. Edit your package.json file to include the following:
{
    "scripts": {
        "test": "jest --color --passWithNoTests",
        "test:watch": "pnpm run test --watch",
        "test:cov": "pnpm run test --coverage"
    }
}

Author

1.2.8

1 year ago

1.2.7

1 year ago

1.2.6

1 year ago

1.2.0

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.1.3

1 year ago

1.2.1

1 year ago

1.1.2

1 year ago

0.3.0

3 years ago

0.4.1

3 years ago

0.3.2

3 years ago

0.4.0

3 years ago

0.3.1

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.0.21

3 years ago

0.0.22

3 years ago

0.0.23

3 years ago

0.0.24

3 years ago

0.0.25

3 years ago

0.0.20

3 years ago

0.0.19

3 years ago

0.0.18

3 years ago

0.0.17

3 years ago

0.0.16

3 years ago

0.0.15

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago