fix: log hybrid module as warning instead of failing tests#5144
Conversation
WalkthroughAdds E2E test infrastructure for a hybrid-module feature, including test specifications and Jest configurations for both CommonJS and ES modules. Refactors compiler diagnostic handling to use explicit diagnostic raising via Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
6193853 to
b9cbdd1
Compare
86805a1 to
be2a95d
Compare
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
e2e/hybrid-module/__tests__/hybrid-module.spec.ts(1 hunks)e2e/hybrid-module/jest-compiler-cjs.config.ts(1 hunks)e2e/hybrid-module/jest-compiler-esm.config.ts(1 hunks)e2e/hybrid-module/package.json(1 hunks)e2e/hybrid-module/tsconfig.spec.json(1 hunks)src/legacy/compiler/ts-compiler.spec.ts(1 hunks)src/legacy/compiler/ts-compiler.ts(1 hunks)src/transpilers/typescript/transpile-module.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: ahnpnl
Repo: kulshekhar/ts-jest PR: 4976
File: examples/js-with-babel/package.json:14-19
Timestamp: 2025-08-05T08:03:52.583Z
Learning: ts-jest version 29 supports both Jest 29 and Jest 30, so having ts-jest 29.x with Jest 30.x is not a compatibility issue and should not be flagged as a version mismatch problem.
📚 Learning: 2025-08-05T08:03:52.583Z
Learnt from: ahnpnl
Repo: kulshekhar/ts-jest PR: 4976
File: examples/js-with-babel/package.json:14-19
Timestamp: 2025-08-05T08:03:52.583Z
Learning: ts-jest version 29 supports both Jest 29 and Jest 30, so having ts-jest 29.x with Jest 30.x is not a compatibility issue and should not be flagged as a version mismatch problem.
Applied to files:
e2e/hybrid-module/jest-compiler-esm.config.tse2e/hybrid-module/jest-compiler-cjs.config.ts
🧬 Code graph analysis (4)
e2e/hybrid-module/jest-compiler-esm.config.ts (1)
src/constants.ts (1)
TS_JS_TRANSFORM_PATTERN(8-8)
src/legacy/compiler/ts-compiler.ts (2)
src/utils/diagnostics.ts (1)
TsJestDiagnosticCodes(1-5)src/utils/messages.ts (1)
Helps(30-35)
src/legacy/compiler/ts-compiler.spec.ts (1)
src/utils/messages.ts (1)
Helps(30-35)
e2e/hybrid-module/jest-compiler-cjs.config.ts (1)
src/constants.ts (1)
TS_JS_TRANSFORM_PATTERN(8-8)
🔇 Additional comments (7)
e2e/hybrid-module/package.json (1)
1-4: LGTM!The minimal package manifest is appropriate for an e2e test module.
src/legacy/compiler/ts-compiler.ts (1)
213-224: LGTM! Diagnostic handling now respects ignoreCodes configuration.The shift from array mutation to explicit
raiseDiagnostics()ensures the modern Node module diagnostic can be filtered viadiagnostics.ignoreCodes, fixing issue #5130.src/legacy/compiler/ts-compiler.spec.ts (1)
394-398: LGTM! Test correctly validates the new behavior.The test now verifies that the modern Node module diagnostic is logged as a warning rather than returned in the diagnostics array, confirming the fix allows proper filtering.
e2e/hybrid-module/tsconfig.spec.json (1)
1-3: LGTM!The minimal tsconfig appropriately extends the base configuration for the e2e test environment.
e2e/hybrid-module/jest-compiler-cjs.config.ts (1)
1-17: LGTM! Configuration correctly demonstrates diagnostic filtering.The
ignoreCodes: [151002]configuration validates that the fix allows the hybrid module diagnostic to be suppressed as intended.e2e/hybrid-module/jest-compiler-esm.config.ts (1)
1-19: LGTM! ESM configuration correctly demonstrates diagnostic filtering.The ESM variant properly includes
ignoreCodes: [151002]alongsideuseESM: true, validating that the fix works in ESM mode.src/transpilers/typescript/transpile-module.ts (1)
51-57: The literal value102for ModuleKind.Node20 is correct and aligns with TypeScript 5.9's enum definition (ESNext=99, Node16=100, Node20=102, NodeNext=199).



Summary
Fixes #5130
Test plan
Green CI
Does this PR introduce a breaking change?
Other information
N.A.
Summary by CodeRabbit
New Features
Improvements
Tests
✏️ Tip: You can customize this high-level summary in your review settings.