Skip to content

A modern, self-hosted backup solution for secure, encrypted backups across local and cloud storage.

test: resolves jest oom issue

towfiqi6115bb2b6d27
diff --git a/backend/jest.config.ts b/backend/jest.config.ts
index 49d4906..6311f2c 100644
--- a/backend/jest.config.ts
+++ b/backend/jest.config.ts
@@ -9,8 +9,8 @@ const config: Config = {
// 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: 4,
- workerIdleMemoryLimit: '512MB',
+ maxWorkers: process.env.CI ? 2 : 4,
+ workerIdleMemoryLimit: '2048MB',
// Explicitly define the transform using ts-jest
transform: {
diff --git a/backend/package.json b/backend/package.json
index c09ee2a..1072ee0 100644
--- a/backend/package.json
+++ b/backend/package.json
@@ -120,7 +120,7 @@
"lint": "eslint src/**/*.ts",
"migrate-db": "tsx -r dotenv/config src/db/migrate.ts",
"start": "node dist/index.js",
- "test": "jest --config jest.config.ts",
+ "test": "cross-env NODE_OPTIONS=--max-old-space-size=4096 jest --config jest.config.ts",
"build:pkg": "node ./scripts/build-pkg.js",
"clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true});require('fs').rmSync('public',{recursive:true,force:true})\"",
"copy:frontend": "node -e \"const fs=require('fs');const path=require('path');const src='../frontend/dist';if(!fs.existsSync(src)){console.log('Skipping copy:frontend - frontend dist not found');process.exit(0)};function copyDir(s,d){fs.mkdirSync(d,{recursive:true});fs.readdirSync(s,{withFileTypes:true}).forEach(e=>{const sp=path.join(s,e.name),dp=path.join(d,e.name);e.isDirectory()?copyDir(sp,dp):fs.copyFileSync(sp,dp)})};copyDir(src,'public')\"",