fix bruno collection
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Test Setup — Handle platform-specific issues gracefully
|
||||
*
|
||||
* This file runs before tests to handle:
|
||||
* - Platform mismatches (macOS binaries in Linux environment)
|
||||
* - Native module loading failures (better-sqlite3, esbuild)
|
||||
* - Environment-specific test skipping
|
||||
*/
|
||||
|
||||
const canLoadNativeModules = () => {
|
||||
try {
|
||||
require('better-sqlite3');
|
||||
return true;
|
||||
} catch (err) {
|
||||
if (err.code === 'ERR_MODULE_NOT_FOUND' || err.message.includes('wrong platform')) {
|
||||
return false;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
export const canRunDatabaseTests = canLoadNativeModules();
|
||||
|
||||
// Set environment variable for test suite
|
||||
if (!canRunDatabaseTests) {
|
||||
process.env.SKIP_DATABASE_TESTS = 'true';
|
||||
console.warn('⚠️ Native modules not available (platform mismatch detected)');
|
||||
console.warn(' Skipping database-dependent tests');
|
||||
console.warn(' Run tests on macOS or rebuild with: npm ci');
|
||||
}
|
||||
Reference in New Issue
Block a user