mirror of
https://github.com/Redocly/redoc.git
synced 2025-11-06 18:57:30 +03:00
Co-authored-by: Roman Hotsiy <gotsijroman@gmail.com> Co-authored-by: Alex Varchuk <olexandr.varchuk@gmail.com> Co-authored-by: Oprysk Vyacheslav <vyacheslav@redocly.com> Co-authored-by: Ivan Kropyvnytskyi <130547411+ivankropyvnytskyi@users.noreply.github.com> Co-authored-by: Yevhen Pylyp <yevhen.pylyp@redocly.com> Co-authored-by: Vladyslav Makarenko <vladyslav.makarenko@redocly.com> Co-authored-by: Yevhenii Medviediev <yevhenii.medviediev@redocly.com> Co-authored-by: Oleksii Horbachevskyi <oleksii.horbachevskyi@redocly.com> Co-authored-by: volodymyr-rutskyi <rutskyi.v@gmail.com> Co-authored-by: Adam Altman <adam@redoc.ly> Co-authored-by: Andrew Tatomyr <andrew.tatomyr@redocly.com> Co-authored-by: Anastasiia Derymarko <anastasiia@redocly.com> Co-authored-by: Roman Marshevskyy <roman.marshevskyy@redoc.ly> Co-authored-by: Lorna Mitchell <lorna.mitchell@redocly.com> Co-authored-by: Taylor Krusen <taylor.krusen@redocly.com>
90 lines
2.2 KiB
JavaScript
90 lines
2.2 KiB
JavaScript
import { createRequire } from 'module';
|
|
|
|
const require = createRequire(import.meta.url);
|
|
|
|
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
|
|
/** @type {import('jest').Config} */
|
|
export default {
|
|
verbose: true,
|
|
testEnvironment: 'jsdom',
|
|
setupFilesAfterEnv: ['<rootDir>/src/setupTests.ts'],
|
|
preset: 'ts-jest',
|
|
collectCoverage: true,
|
|
coverageProvider: 'v8',
|
|
collectCoverageFrom: ['src/**/*.{ts,tsx}', '!src/**/{index,types}.ts', '!src/events/*'],
|
|
testPathIgnorePatterns: ['/node_modules/', '/bundle/', '/__mocks__/', '/src/icons/'],
|
|
coverageThreshold: {
|
|
global: {
|
|
statements: 78,
|
|
branches: 68,
|
|
functions: 76,
|
|
lines: 78,
|
|
},
|
|
},
|
|
coverageReporters: ['json', 'lcov', 'text', 'text-summary'],
|
|
coveragePathIgnorePatterns: [
|
|
'\\.d\\.ts$',
|
|
'/node_modules/',
|
|
'__mock__',
|
|
'/src/types/',
|
|
'/src/icons/',
|
|
],
|
|
modulePathIgnorePatterns: [
|
|
'/__mocks__/',
|
|
'/benchmark/',
|
|
'/coverage/',
|
|
'src/components/__tests__/mocks/*',
|
|
'src/models/__tests__/helpers.ts',
|
|
'src/icons/*',
|
|
'/bundle/',
|
|
'lib/',
|
|
'/playground/',
|
|
'/playwright/',
|
|
'/scripts/',
|
|
],
|
|
transform: {
|
|
'^.+\\.[tj]sx?$': [
|
|
'ts-jest',
|
|
{
|
|
isolatedModules: true,
|
|
useESM: true,
|
|
astTransformers: {
|
|
before: [
|
|
{
|
|
path: 'ts-jest-mock-import-meta',
|
|
options: { metaObjectReplacement: { url: '' } },
|
|
},
|
|
],
|
|
},
|
|
tsconfig: {
|
|
moduleResolution: 'node',
|
|
module: 'ESNext',
|
|
jsx: 'react-jsx',
|
|
},
|
|
},
|
|
],
|
|
'node_modules/.pnpm/@redocly.+\\.js$': [
|
|
'ts-jest',
|
|
{
|
|
isolatedModules: true,
|
|
useESM: true,
|
|
tsconfig: {
|
|
moduleResolution: 'node',
|
|
module: 'ESNext',
|
|
allowJs: true,
|
|
},
|
|
},
|
|
],
|
|
},
|
|
extensionsToTreatAsEsm: ['.ts', '.tsx'],
|
|
// Custom module mapper to handle @redocly packages
|
|
moduleNameMapper: {
|
|
'\\.(css|less)$': '<rootDir>/src/empty.js',
|
|
'^(\\.{1,2}/.*)\\.js$': '$1',
|
|
},
|
|
transformIgnorePatterns: [
|
|
`/node_modules/.pnpm/(?!vscode-languageserver-types|vscode-languageserver-textdocument|@redocly)`,
|
|
],
|
|
prettierPath: require.resolve('prettier'),
|
|
};
|