mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-18 05:52:10 +00:00
`maxWorkers: '50%'` resolves to a single worker on the 2-vCPU GitHub-hosted runners that private repositories get, and Jest then runs in band. Any test file that leaves a handle open (a listening `http.Server`, a timer, a DB connection) keeps the main process alive after "Ran all test suites" until the job's `timeout-minutes` cancels it, so a run with every test passing still fails. Public runners have 4 vCPUs, where `'50%'` is already two workers and the leaked handle dies with the worker process. Move the worker count into `config/jest.workers.cjs`, shared by all six workspace configs: local runs keep `'50%'`, CI uses `max(2, floor(cpus / 2))`. On 4-vCPU runners the value is unchanged; on 2-vCPU runners Jest now uses worker processes the same way it does upstream. Co-authored-by: Danny Avila <danny@librechat.ai>
60 lines
1.4 KiB
JavaScript
60 lines
1.4 KiB
JavaScript
import { maxWorkers } from '../../config/jest.workers.cjs';
|
|
|
|
const esModules = [
|
|
'@langchain/langgraph',
|
|
'@langchain/langgraph-checkpoint',
|
|
'@langchain/langgraph-sdk',
|
|
'@mistralai/mistralai',
|
|
'domelementtype',
|
|
'domhandler',
|
|
'dom-serializer',
|
|
'domutils',
|
|
'entities',
|
|
'htmlparser2',
|
|
'sanitize-html',
|
|
'uuid',
|
|
].join('|');
|
|
|
|
export default {
|
|
collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}', '!<rootDir>/node_modules/'],
|
|
coveragePathIgnorePatterns: ['/node_modules/', '/dist/'],
|
|
testPathIgnorePatterns: [
|
|
'/node_modules/',
|
|
'/dist/',
|
|
'\\.dev\\.ts$',
|
|
'\\.helper\\.ts$',
|
|
'\\.helper\\.d\\.ts$',
|
|
'/__tests__/helpers/',
|
|
'\\.manual\\.spec\\.[jt]sx?$',
|
|
],
|
|
coverageReporters: ['text', 'cobertura'],
|
|
testResultsProcessor: 'jest-junit',
|
|
transform: {
|
|
'\\.[jt]sx?$': [
|
|
'babel-jest',
|
|
{
|
|
presets: [
|
|
['@babel/preset-env', { targets: { node: 'current' } }],
|
|
'@babel/preset-typescript',
|
|
],
|
|
},
|
|
],
|
|
},
|
|
transformIgnorePatterns: [`/node_modules/(?!(${esModules})/).*/`],
|
|
moduleNameMapper: {
|
|
'^@src/(.*)$': '<rootDir>/src/$1',
|
|
'~/(.*)': '<rootDir>/src/$1',
|
|
},
|
|
// coverageThreshold: {
|
|
// global: {
|
|
// statements: 58,
|
|
// branches: 49,
|
|
// functions: 50,
|
|
// lines: 57,
|
|
// },
|
|
// },
|
|
setupFiles: ['<rootDir>/jest.setup.cjs', '<rootDir>/../../config/jest.setup.logging.cjs'],
|
|
maxWorkers,
|
|
restoreMocks: true,
|
|
testTimeout: 15000,
|
|
};
|