mirror of
https://github.com/di-sukharev/opencommit.git
synced 2026-01-09 21:58:09 -05:00
Resolves persistent `ReferenceError: exports is not defined` errors encountered during unit tests (`unit-test (20.x)` job) in the GitHub Actions CI environment. These errors occurred specifically when importing `cli-testing-library` in the global Jest setup file (`test/jest-setup.ts`), despite tests passing locally with the same Node.js version (v20.19.0). After iterative testing, the following Jest configuration combination was identified as necessary to ensure consistent ESM handling and test success in both local and CI environments: - Set preset to `ts-jest/presets/default-esm` for stricter ESM rules. - Configured `transformIgnorePatterns` to ensure Jest transforms specific ESM dependencies (`cli-testing-library`, `@clack`, `cleye`) within `node_modules`. - Expanded the `transform` pattern (`^.+\\.(ts|tsx|js|jsx|mjs)$`) to explicitly cover various script types handled by `ts-jest`. - Included explicit `tsconfig` overrides (`module: 'ESNext'`, `target: 'ES2022'`) within the `ts-jest` transform options to resolve potential environment discrepancies. - Retained `moduleNameMapper` for `.js` imports for reliable module resolution. - Ensured `cli-testing-library` imports remain in the global setup (`test/jest-setup.ts`). - Removed test cache clearing from the `test:unit` script in `package.json`. This configuration now passes reliably across environments.
15 lines
153 B
Plaintext
15 lines
153 B
Plaintext
node_modules/
|
|
coverage/
|
|
temp/
|
|
build/
|
|
application.log
|
|
.DS_Store
|
|
/*.env
|
|
logfile.log
|
|
uncaughtExceptions.log
|
|
.vscode
|
|
src/*.json
|
|
.idea
|
|
test.ts
|
|
notes.md
|
|
.nvmrc |