You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ts-jest has a isolatedModules option, which, when set to true, makes the program undefined, from this PR.
This causes the ModelClassVisitor and ControllerClassVisitor to immediately fail to retrieve the type checker.
● Test suite failed to run
TypeError: Cannot read properties of undefined (reading 'getTypeChecker')
at ModelClassVisitor.visit (node_modules/@nestjs/swagger/dist/plugin/visitors/model-class.visitor.js:35:37)
at node_modules/@nestjs/swagger/dist/plugin/compiler-plugin.js:15:42
at transformSourceFileOrBundle (node_modules/typescript/lib/typescript.js:89058:51)
at transformation (node_modules/typescript/lib/typescript.js:112184:16)
at transformRoot (node_modules/typescript/lib/typescript.js:112207:73)
at transformNodes (node_modules/typescript/lib/typescript.js:112192:72)
at emitJsFileOrBundle (node_modules/typescript/lib/typescript.js:112779:26)
at emitSourceFileOrBundle (node_modules/typescript/lib/typescript.js:112714:7)
at forEachEmittedFile (node_modules/typescript/lib/typescript.js:112468:26)
at emitFiles (node_modules/typescript/lib/typescript.js:112688:5)
at emitWorker (node_modules/typescript/lib/typescript.js:120187:26)
at node_modules/typescript/lib/typescript.js:120172:53
at runWithCancellationToken (node_modules/typescript/lib/typescript.js:120261:16)
at Object.emit (node_modules/typescript/lib/typescript.js:120172:22)
at Object.transpileModule (node_modules/typescript/lib/typescript.js:135707:13)
at TsCompiler._transpileOutput (node_modules/ts-jest/dist/legacy/compiler/ts-compiler.js:211:25)
at TsCompiler.getCompiledOutput (node_modules/ts-jest/dist/legacy/compiler/ts-compiler.js:201:31)
at TsJestCompiler.getCompiledOutput (node_modules/ts-jest/dist/legacy/compiler/ts-jest-compiler.js:14:39)
at TsJestTransformer.exports.TsJestTransformer.TsJestTransformer.processWithTs (node_modules/ts-jest/dist/legacy/ts-jest-transformer.js:259:37)
at TsJestTransformer.exports.TsJestTransformer.TsJestTransformer.process (node_modules/ts-jest/dist/legacy/ts-jest-transformer.js:188:24)
at ScriptTransformer.transformSource (node_modules/@jest/transform/build/ScriptTransformer.js:545:31)
at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:674:40)
at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:726:19)
[... source code redacted]
The compiler plugin should still work if isolatedModules is set to true, though I'm not sure how this would be done with how tightly coupled the compiler plugin is with the TS Program.
You may be able to instantiate a ts.Program object in the compiler plugin, not sure how that would work.
Package version
7.1.31
NestJS version
10.3.3
Node.js version
20.10.0
In which operating systems have you tested?
macOS
Windows
Linux
Other
No response
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
Current behavior
ts-jest has a isolatedModules option, which, when set to true, makes the program undefined, from this PR.
This causes the ModelClassVisitor and ControllerClassVisitor to immediately fail to retrieve the type checker.
Minimum reproduction code
https://github.com/edeesis/swagger-reproduce
Steps to reproduce
npm install
npm run test:e2e
Expected behavior
The compiler plugin should still work if isolatedModules is set to true, though I'm not sure how this would be done with how tightly coupled the compiler plugin is with the TS Program.
You may be able to instantiate a ts.Program object in the compiler plugin, not sure how that would work.
Package version
7.1.31
NestJS version
10.3.3
Node.js version
20.10.0
In which operating systems have you tested?
Other
No response
The text was updated successfully, but these errors were encountered: