-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathjest.config.ts
27 lines (24 loc) · 932 Bytes
/
jest.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import type { Config } from '@jest/types';
import path from 'path';
import { lstatSync, readdirSync } from 'fs';
const basePath = path.resolve(__dirname, 'packages');
const packages = readdirSync(basePath).filter((name) => lstatSync(path.join(basePath, name)).isDirectory());
const config: Config.InitialOptions = {
preset: 'ts-jest',
coverageDirectory: 'coverage',
coverageProvider: 'v8',
testEnvironment: 'node',
testMatch: ['<rootDir>/**/src/**/*.spec.{ts,js}'],
moduleNameMapper: {
...packages.reduce(
(acc, name) => ({
...acc,
[`@salutejs/${name}(.*)$`]: `<rootDir>/packages/./${name}/src/$1`,
}),
{},
),
},
modulePathIgnorePatterns: [...packages.reduce((acc, name) => [...acc, `<rootDir>/packages/${name}/dist`], [])],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
};
export default config;