Problem
Currently, integration tests that use dynamic import() are mixed with unit tests:
- Unit tests use mocked dependencies and work without build
- Integration tests load real packages via
import() and require build artifacts from dist/
- CI must build before ALL tests run, even though most don't need it
Example: packages/driver-loader/src/loader.test.ts contains both:
- Unit tests with mocked
deps.importModule (no build needed)
- Integration test that calls real
import('ya-modbus-driver-xymd1') (build needed)
Proposed Solution
Extract integration tests into separate files or test groups:
Option 1: Separate Files
packages/driver-loader/src/loader.test.ts # Unit tests (no build)
packages/driver-loader/src/loader.integration.ts # Integration tests (needs build)
Option 2: Jest Test Groups
// jest.config.cjs
module.exports = {
projects: [
{
displayName: 'unit',
testMatch: ['**/*.test.ts'],
testPathIgnorePatterns: ['integration'],
},
{
displayName: 'integration',
testMatch: ['**/*.integration.ts'],
},
],
}
Benefits
- Faster CI: Run unit tests without build
- Clear separation: Developers know which tests need build
- Better organization: Integration tests have different requirements (slower, need build)
CI Workflow
With separation, CI could:
npm ci
npm run lint (no build needed)
npm run test:unit (no build needed)
npm run build
npm run test:integration (uses build artifacts)
Files to Check
Search for integration tests that might need build:
rg -l "describe.*integration" --type ts
rg -l "import\(" packages --type ts
Most likely candidates:
packages/driver-loader/src/loader.test.ts - confirmed has integration test
- Check other packages for similar patterns
References
- Current CI workflow:
.github/workflows/ci.yml
- Jest config:
jest.config.cjs
- Testing guidelines:
docs/agents/testing.md
Problem
Currently, integration tests that use dynamic
import()are mixed with unit tests:import()and require build artifacts fromdist/Example:
packages/driver-loader/src/loader.test.tscontains both:deps.importModule(no build needed)import('ya-modbus-driver-xymd1')(build needed)Proposed Solution
Extract integration tests into separate files or test groups:
Option 1: Separate Files
Option 2: Jest Test Groups
Benefits
CI Workflow
With separation, CI could:
npm cinpm run lint(no build needed)npm run test:unit(no build needed)npm run buildnpm run test:integration(uses build artifacts)Files to Check
Search for integration tests that might need build:
Most likely candidates:
packages/driver-loader/src/loader.test.ts- confirmed has integration testReferences
.github/workflows/ci.ymljest.config.cjsdocs/agents/testing.md