- Implemented real integration tests in `real-integration.test.ts` to validate the functionality of the DebrosFramework with IPFS and OrbitDB. - Created `RealTestUser` and `RealTestPost` models for testing user and post functionalities. - Developed setup and teardown lifecycle methods for managing the test environment. - Introduced `RealIPFSService` and `RealOrbitDBService` classes for managing IPFS and OrbitDB instances. - Added `PrivateSwarmSetup` for configuring a private IPFS network. - Implemented utility functions for creating and shutting down IPFS and OrbitDB networks. - Created a global test manager for managing test lifecycle and network state. - Updated TypeScript configuration to include test files and exclude them from the main build.
52 lines
1.3 KiB
JavaScript
52 lines
1.3 KiB
JavaScript
module.exports = {
|
|
preset: 'ts-jest',
|
|
testEnvironment: 'node',
|
|
roots: ['<rootDir>/tests/real'],
|
|
testMatch: ['**/real/**/*.test.ts'],
|
|
transform: {
|
|
'^.+\\.ts$': [
|
|
'ts-jest',
|
|
{
|
|
isolatedModules: true,
|
|
},
|
|
],
|
|
},
|
|
collectCoverageFrom: ['src/**/*.ts', '!src/**/*.d.ts', '!src/**/index.ts', '!src/examples/**'],
|
|
coverageDirectory: 'coverage-real',
|
|
coverageReporters: ['text', 'lcov', 'html'],
|
|
|
|
// Extended timeouts for real network operations
|
|
testTimeout: 180000, // 3 minutes per test
|
|
|
|
// Run tests serially to avoid port conflicts and resource contention
|
|
maxWorkers: 1,
|
|
|
|
// Setup and teardown
|
|
globalSetup: '<rootDir>/tests/real/jest.global-setup.cjs',
|
|
globalTeardown: '<rootDir>/tests/real/jest.global-teardown.cjs',
|
|
|
|
// Environment variables for real tests
|
|
setupFilesAfterEnv: ['<rootDir>/tests/real/jest.setup.ts'],
|
|
|
|
// Longer timeout for setup/teardown
|
|
setupFilesTimeout: 120000,
|
|
|
|
// Disable watch mode (real tests are too slow)
|
|
watchman: false,
|
|
|
|
// Clear mocks between tests
|
|
clearMocks: true,
|
|
restoreMocks: true,
|
|
|
|
// Verbose output for debugging
|
|
verbose: true,
|
|
|
|
// Fail fast on first error (saves time with slow tests)
|
|
bail: 1,
|
|
|
|
// Module path mapping
|
|
moduleNameMapping: {
|
|
'^@/(.*)$': '<rootDir>/src/$1',
|
|
'^@tests/(.*)$': '<rootDir>/tests/$1'
|
|
}
|
|
}; |