LibreChat/packages/data-schemas/jest.config.mjs
Marco Beretta 346dd274d4
🧠 perf: Recycle Backend Jest Workers Past 1GB (#17098)
A backend jest worker keeps every module and transform it has loaded for its whole life and grows past three gigabytes on a packages/api shard. Share a 1GB workerIdleMemoryLimit from config/jest.workers.cjs and apply it to api, packages/api and data-schemas, as the client config already does.
2026-10-16 22:15:10 +02:00

32 lines
1.3 KiB
JavaScript

import { maxWorkers, workerIdleMemoryLimit } from '../../config/jest.workers.cjs';
export default {
collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}', '!<rootDir>/node_modules/'],
coveragePathIgnorePatterns: ['/node_modules/', '/dist/'],
testPathIgnorePatterns: ['/node_modules/', '/dist/', '/misc/'],
transformIgnorePatterns: [
'/node_modules/(?!mdast-util-|micromark|decode-named-character-reference|devlop|longest-streak|unist-util-|zwitch|character-(?:entities|reference)|parse-entities|stringify-entities|is-(?:alphanumerical|alphabetical|decimal|hexadecimal)|ccount|markdown-table|escape-string-regexp)',
],
coverageReporters: ['text', 'cobertura'],
testResultsProcessor: 'jest-junit',
moduleNameMapper: {
'^@src/(.*)$': '<rootDir>/src/$1',
'^~/(.*)$': '<rootDir>/src/$1',
},
// coverageThreshold: {
// global: {
// statements: 58,
// branches: 49,
// functions: 50,
// lines: 57,
// },
// },
// Download the in-memory MongoDB binary once, before workers fork: on a cold
// cache the parallel downloads race their final rename and fail whole suites.
globalSetup: '<rootDir>/jest.globalSetup.mjs',
setupFiles: ['<rootDir>/../../config/jest.setup.logging.cjs'],
maxWorkers,
workerIdleMemoryLimit,
restoreMocks: true,
testTimeout: 15000,
};