fix: prevent MSW from loading globally to fix CI test hanging
- Remove msw-setup.ts from global vitest setupFiles - Create separate integration-specific MSW setup - Add vitest.config.integration.ts for integration tests - Update package.json to use integration config for integration tests - Update CI workflow to run unit and integration tests separately - Add aggressive cleanup in integration MSW setup for CI environment This prevents MSW from being initialized for unit tests where it's not needed, which was causing tests to hang in CI after all tests completed.
This commit is contained in:
24
vitest.config.integration.ts
Normal file
24
vitest.config.integration.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { defineConfig, mergeConfig } from 'vitest/config';
|
||||
import baseConfig from './vitest.config';
|
||||
|
||||
export default mergeConfig(
|
||||
baseConfig,
|
||||
defineConfig({
|
||||
test: {
|
||||
// Include both global setup and integration-specific MSW setup
|
||||
setupFiles: ['./tests/setup/global-setup.ts', './tests/integration/setup/integration-setup.ts'],
|
||||
// Only include integration tests
|
||||
include: ['tests/integration/**/*.test.ts'],
|
||||
// Integration tests might need more time
|
||||
testTimeout: 30000,
|
||||
// Specific pool options for integration tests
|
||||
poolOptions: {
|
||||
threads: {
|
||||
// Run integration tests sequentially by default
|
||||
singleThread: true,
|
||||
maxThreads: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
);
|
||||
Reference in New Issue
Block a user