1.8.2 • Published 5 months ago

@jpapini/jest-config v1.8.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months 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.8.2

5 months ago

1.8.1

7 months ago

1.6.3

8 months ago

1.8.0

7 months ago

1.6.2

8 months ago

1.6.1

8 months ago

1.6.0

9 months ago

1.4.0

10 months ago

1.2.10

11 months ago

1.7.0

8 months ago

1.3.3

10 months ago

1.5.0

9 months ago

1.3.2

10 months ago

1.3.1

11 months ago

1.3.0

11 months ago

1.2.9

12 months ago

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

4 years ago

0.0.17

4 years ago

0.0.16

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago