2025-02-18 17:50:31 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* For a detailed explanation regarding each configuration property, visit:
|
|
|
|
|
|
* https://jestjs.io/docs/configuration
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2025-07-05 11:27:48 +00:00
|
|
|
|
import type { Config } from 'jest';
|
2025-02-18 17:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
const config: Config = {
|
|
|
|
|
|
|
2025-07-05 11:27:48 +00:00
|
|
|
|
reporters: [
|
|
|
|
|
|
'default',
|
|
|
|
|
|
['jest-html-reporter', {
|
|
|
|
|
|
pageTitle: 'Test Report',
|
|
|
|
|
|
outputPath: './test-report.html',
|
|
|
|
|
|
}]
|
|
|
|
|
|
],
|
|
|
|
|
|
|
2025-02-18 17:50:31 +00:00
|
|
|
|
// Automatically clear mock calls, instances, contexts and results before every test
|
|
|
|
|
|
clearMocks: true,
|
|
|
|
|
|
|
|
|
|
|
|
// Indicates whether the coverage information should be collected while executing the test
|
|
|
|
|
|
collectCoverage: true,
|
|
|
|
|
|
|
|
|
|
|
|
// The directory where Jest should output its coverage files
|
|
|
|
|
|
coverageDirectory: "coverage",
|
|
|
|
|
|
|
|
|
|
|
|
// Indicates which provider should be used to instrument code for coverage
|
2025-05-19 23:33:50 +00:00
|
|
|
|
// coverageProvider: "v8",
|
2025-07-05 11:27:48 +00:00
|
|
|
|
coverageProvider: "babel",
|
2025-02-18 17:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
// An array of file extensions your modules use
|
|
|
|
|
|
moduleFileExtensions: [
|
|
|
|
|
|
"ts",
|
|
|
|
|
|
"tsx",
|
|
|
|
|
|
"js",
|
2025-07-05 11:27:48 +00:00
|
|
|
|
"jsx",
|
2025-02-18 17:50:31 +00:00
|
|
|
|
"json",
|
|
|
|
|
|
"node"
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
|
|
preset: "ts-jest",
|
|
|
|
|
|
|
|
|
|
|
|
testEnvironment: "node",
|
|
|
|
|
|
|
2025-04-11 15:07:53 +00:00
|
|
|
|
// Limit the number of workers that run tests in parallel
|
|
|
|
|
|
maxWorkers: 1, // <--- Задает последовательное выполнение
|
|
|
|
|
|
|
2025-04-26 20:25:41 +00:00
|
|
|
|
moduleNameMapper: {
|
|
|
|
|
|
// Этот паттерн говорит: если импорт начинается с 'src/',
|
|
|
|
|
|
// замени 'src/' на '<rootDir>/src/' при поиске файла.
|
|
|
|
|
|
'^src/(.*)$': '<rootDir>/src/$1',
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2025-07-05 11:27:48 +00:00
|
|
|
|
testPathIgnorePatterns: [
|
2025-05-21 12:32:53 +00:00
|
|
|
|
"/node_modules/", // Хорошо иметь это явно, хотя Jest часто делает это по умолчанию
|
|
|
|
|
|
"/__tests__/fakes/" // Исключаем папку fakes внутри __tests__
|
|
|
|
|
|
],
|
2025-07-05 11:27:48 +00:00
|
|
|
|
|
2025-02-18 17:50:31 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export default config;
|