Files
outline/server/test/globalSetup.js
T
codegen-sh[bot] 37a6a791f2 feat: implement order-of-magnitude test performance improvements
- Replace expensive TRUNCATE CASCADE with transaction rollback strategy (5-10x speedup)
- Add SQLite in-memory database support for unit tests (10-100x speedup)
- Optimize Jest configuration for better parallelization (75% workers)
- Add comprehensive performance monitoring and metrics
- Create fast test execution modes (test:fast, test:unit, test:integration)
- Add detailed performance optimization documentation

Expected combined performance improvement: 10-50x faster test execution
2025-07-16 13:39:51 +00:00

21 lines
737 B
JavaScript

import { sequelize } from "@server/storage/database";
module.exports = async function () {
// Performance optimization: Instead of expensive TRUNCATE CASCADE,
// we'll use a transaction-based approach for test isolation.
// This setup ensures the database is ready for transaction-based testing.
try {
// Ensure database connection is established
await sequelize.authenticate();
// Only perform minimal setup - individual tests will use transactions
// eslint-disable-next-line no-console
console.log("Database connection established for testing");
} catch (error) {
// eslint-disable-next-line no-console
console.error("Failed to establish database connection:", error);
throw error;
}
};