fixing tests

This commit is contained in:
orangecoding
2025-12-17 16:35:24 +01:00
parent 6e8a35a836
commit 05f1bc61c9
2 changed files with 23 additions and 9 deletions

View File

@@ -19,8 +19,13 @@ import { runMigrations, listMigrationFiles } from './migrations/migrate.js';
let _AdmZipSingleton = null;
async function getAdmZip() {
if (_AdmZipSingleton) return _AdmZipSingleton;
// Allow tests to provide a mock constructor without ESM loader intricacies
if (globalThis && globalThis.__TEST_ADM_ZIP__) {
_AdmZipSingleton = globalThis.__TEST_ADM_ZIP__;
return _AdmZipSingleton;
}
const mod = await import('adm-zip');
_AdmZipSingleton = mod.default || mod;
_AdmZipSingleton = (mod && mod.default) || mod;
return _AdmZipSingleton;
}