A modern, self-hosted backup solution for secure, encrypted backups across local and cloud storage.
import type { Config } from 'jest';
const config: Config = {
// preset: 'ts-jest',
testEnvironment: 'node',
verbose: true,
clearMocks: true,
// Limit workers to prevent OOM and recycle workers that accumulate memory.
// A fixed cap (not a core-percentage) keeps concurrent ts-jest compilation
// from exhausting native/zone memory on high-core machines.
maxWorkers: process.env.CI ? 2 : 4,
workerIdleMemoryLimit: '2048MB',
// Explicitly define the transform using ts-jest
transform: {
// This regex now tells Jest to use ts-jest for .ts, .tsx, .js, and .jsx files
'^.+\\.(t|j)sx?$': [
'ts-jest',
{
useESM: true,
tsconfig: {
module: 'esnext',
target: 'esnext',
moduleResolution: 'bundler',
esModuleInterop: true,
allowSyntheticDefaultImports: true,
// Transpile each file in isolation instead of building a
// whole-program type graph — the main source of worker OOM.
isolatedModules: true,
},
diagnostics: false,
},
],
},
// ------------------------------
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
extensionsToTreatAsEsm: ['.ts'],
// Tell Jest to only look for test files inside the __tests__ directory
testMatch: ['**/__tests__/**/*.test.ts'],
moduleNameMapper: {
// This alias is now even more important to keep imports clean
'^#core-backend/(.*)$': '<rootDir>/src/$1',
},
setupFiles: ['<rootDir>/__tests__/env-setup.ts'],
setupFilesAfterEnv: ['<rootDir>/__tests__/setup.ts'],
transformIgnorePatterns: ['/node_modules/(?!nanoid)/'],
};
export default config;