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
Importing and using a mixin from a package in the same yarn workspace shows error
TypeError: Class constructor cannot be invoked without 'new'
Expected behavior :
should not error.
should behave identically to running tools separately. i.e.
configuring jest to point to the build folder output of tsc (instead of src) and running the following produces no errors:
tsc -b .
jest
One strange thing is that the types generated related to mixins applied base class imported from a different package and mixin defined in the same package are slightly different. (File: server/build/Product.d.ts). Everything else seems to be the exact same.
# content of ts-jest.log :
{"context":{"allowJs":false,"logLevel":20,"namespace":"jest-preset","package":"ts-jest","version":"24.0.2"},"message":"creating jest presets not handling JavaScript files","sequence":1,"time":"2019-05-26T04:27:28.138Z"}
{"context":{"logLevel":20,"namespace":"Importer","package":"ts-jest","version":"24.0.2"},"message":"creating Importer singleton","sequence":2,"time":"2019-05-26T04:27:28.866Z"}
{"context":{"allowJs":false,"logLevel":20,"namespace":"jest-preset","package":"ts-jest","version":"24.0.2"},"message":"creating jest presets not handling JavaScript files","sequence":3,"time":"2019-05-26T04:27:28.870Z"}
{"context":{"actualVersion":"24.8.0","expectedVersion":">=24 <25","logLevel":20,"namespace":"versions","package":"ts-jest","version":"24.0.2"},"message":"checking version of jest: OK","sequence":4,"time":"2019-05-26T04:27:28.872Z"}
{"context":{"baseOptions":{},"logLevel":20,"namespace":"jest-transformer","package":"ts-jest","transformerId":1,"version":"24.0.2"},"message":"created new transformer","sequence":5,"time":"2019-05-26T04:27:28.872Z"}
{"context":{"fileName":"/js/server/src/spec.ts","logLevel":20,"namespace":"jest-transformer","package":"ts-jest","transformOptions":{"config":{"automock":false,"browser":false,"cache":true,"cacheDirectory":"/tmp/jest_0","clearMocks":true,"coveragePathIgnorePatterns":["/node_modules/"],"cwd":"/js","dependencyExtractor":null,"detectLeaks":false,"detectOpenHandles":false,"displayName":"SERVER","errorOnDeprecated":false,"filter":null,"forceCoverageMatch":[],"globalSetup":null,"globalTeardown":null,"globals":{"ts-jest":{"tsConfig":"tsconfig.json"}},"haste":{"computeSha1":false,"providesModuleNodeModules":[],"throwOnModuleCollision":false},"moduleDirectories":["node_modules"],"moduleFileExtensions":["js","json","jsx","ts","tsx","node"],"moduleNameMapper":{},"modulePathIgnorePatterns":[],"name":"524dcda91d222f1438dacdc6254406cd","prettierPath":"prettier","resetMocks":false,"resetModules":false,"resolver":null,"restoreMocks":false,"rootDir":"/js/server","roots":["/js/server/src"],"runner":"jest-runner","setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"snapshotSerializers":[],"testEnvironment":"/js/node_modules/jest-environment-node/build/index.js","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":["**/__spec__/**/*.ts","**/?(*.)spec.ts"],"testPathIgnorePatterns":["/node_modules/"],"testRegex":[],"testRunner":"/js/node_modules/jest-jasmine2/build/index.js","testURL":"http://localhost","timers":"real","transform":[["^.+\\.tsx?$","/js/node_modules/ts-jest/dist/index.js"]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]},"instrument":false,"rootDir":"/js/server"},"transformerId":1,"version":"24.0.2"},"message":"computing cache key for /js/server/src/spec.ts","sequence":6,"time":"2019-05-26T04:27:28.873Z"}
{"context":{"logLevel":30,"namespace":"jest-transformer","package":"ts-jest","transformerId":1,"version":"24.0.2"},"message":"no matching config-set found, creating a new one","sequence":7,"time":"2019-05-26T04:27:28.873Z"}
{"context":{"config":{"automock":false,"browser":false,"cache":true,"cacheDirectory":"/tmp/jest_0","clearMocks":true,"coveragePathIgnorePatterns":["/node_modules/"],"cwd":"/js","dependencyExtractor":null,"detectLeaks":false,"detectOpenHandles":false,"displayName":"SERVER","errorOnDeprecated":false,"filter":null,"forceCoverageMatch":[],"globalSetup":null,"globalTeardown":null,"globals":{"ts-jest":{"tsConfig":"tsconfig.json"}},"haste":{"computeSha1":false,"providesModuleNodeModules":[],"throwOnModuleCollision":false},"moduleDirectories":["node_modules"],"moduleFileExtensions":["js","json","jsx","ts","tsx","node"],"moduleNameMapper":{},"modulePathIgnorePatterns":[],"name":"524dcda91d222f1438dacdc6254406cd","prettierPath":"prettier","resetMocks":false,"resetModules":false,"resolver":null,"restoreMocks":false,"rootDir":"/js/server","roots":["/js/server/src"],"runner":"jest-runner","setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"snapshotSerializers":[],"testEnvironment":"/js/node_modules/jest-environment-node/build/index.js","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":["**/__spec__/**/*.ts","**/?(*.)spec.ts"],"testPathIgnorePatterns":["/node_modules/"],"testRegex":[],"testRunner":"/js/node_modules/jest-jasmine2/build/index.js","testURL":"http://localhost","timers":"real","transform":[["^.+\\.tsx?$","/js/node_modules/ts-jest/dist/index.js"]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]},"logLevel":20,"namespace":"backports","package":"ts-jest","transformerId":1,"version":"24.0.2"},"message":"backporting config","sequence":8,"time":"2019-05-26T04:27:28.874Z"}
{"context":{"jestConfig":{"automock":false,"browser":false,"cache":true,"cacheDirectory":"/tmp/jest_0","clearMocks":true,"coveragePathIgnorePatterns":["/node_modules/"],"cwd":"/js","dependencyExtractor":null,"detectLeaks":false,"detectOpenHandles":false,"displayName":"SERVER","errorOnDeprecated":false,"filter":null,"forceCoverageMatch":[],"globalSetup":null,"globalTeardown":null,"globals":{"ts-jest":{"tsConfig":"tsconfig.json"}},"haste":{"computeSha1":false,"providesModuleNodeModules":[],"throwOnModuleCollision":false},"moduleDirectories":["node_modules"],"moduleFileExtensions":["js","json","jsx","ts","tsx","node"],"moduleNameMapper":{},"modulePathIgnorePatterns":[],"name":"524dcda91d222f1438dacdc6254406cd","prettierPath":"prettier","resetMocks":false,"resetModules":false,"resolver":null,"restoreMocks":false,"rootDir":"/js/server","roots":["/js/server/src"],"runner":"jest-runner","setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"snapshotSerializers":[],"testEnvironment":"/js/node_modules/jest-environment-node/build/index.js","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":["**/__spec__/**/*.ts","**/?(*.)spec.ts"],"testPathIgnorePatterns":["/node_modules/"],"testRegex":[],"testRunner":"/js/node_modules/jest-jasmine2/build/index.js","testURL":"http://localhost","timers":"real","transform":[["^.+\\.tsx?$","/js/node_modules/ts-jest/dist/index.js"]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]},"logLevel":20,"namespace":"config","package":"ts-jest","transformerId":1,"version":"24.0.2"},"message":"normalized jest config","sequence":9,"time":"2019-05-26T04:27:28.874Z"}
{"context":{"fromPath":"tsconfig.json","logLevel":20,"namespace":"config","package":"ts-jest","toPath":"/js/tsconfig.json","transformerId":1,"version":"24.0.2"},"message":"resolved path from tsconfig.json to /js/tsconfig.json","sequence":10,"time":"2019-05-26T04:27:28.875Z"}
{"context":{"logLevel":20,"namespace":"config","package":"ts-jest","transformerId":1,"tsJestConfig":{"compiler":"typescript","diagnostics":{"ignoreCodes":[6059,18002,18003],"pretty":true,"throws":true},"isolatedModules":false,"packageJson":{"kind":"file"},"transformers":[],"tsConfig":{"kind":"file","value":"/js/tsconfig.json"}},"version":"24.0.2"},"message":"normalized ts-jest config","sequence":11,"time":"2019-05-26T04:27:28.875Z"}
{"context":{"logLevel":20,"namespace":"config","package":"ts-jest","transformerId":1,"version":"24.0.2"},"message":"babel is disabled","sequence":12,"time":"2019-05-26T04:27:28.877Z"}
{"context":{"logLevel":20,"namespace":"Importer","package":"ts-jest","requireResult":{"exists":true,"given":"typescript","path":"/js/node_modules/typescript/lib/typescript.js"},"version":"24.0.2"},"message":"loaded module typescript","sequence":13,"time":"2019-05-26T04:27:29.135Z"}
{"context":{"logLevel":20,"namespace":"Importer","package":"ts-jest","version":"24.0.2"},"message":"patching typescript","sequence":14,"time":"2019-05-26T04:27:29.135Z"}
{"context":{"actualVersion":"3.5.0-rc","expectedVersion":">=2.7 <4","logLevel":20,"namespace":"versions","package":"ts-jest","version":"24.0.2"},"message":"checking version of typescript: NOT OK","sequence":15,"time":"2019-05-26T04:27:29.136Z"}
{"context":{"logLevel":40,"namespace":"versions","package":"ts-jest","version":"24.0.2"},"message":"Version 3.5.0-rc of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=2.7.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions.","sequence":16,"time":"2019-05-26T04:27:29.136Z"}
{"context":{"logLevel":20,"namespace":"config","package":"ts-jest","transformerId":1,"tsConfigFileName":"/js/tsconfig.json","version":"24.0.2"},"message":"readTsConfig(): reading /js/tsconfig.json","sequence":17,"time":"2019-05-26T04:27:29.136Z"}{"context":{"logLevel":20,"namespace":"config","package":"ts-jest","transformerId":1,"tsconfig":{"input":{"compilerOptions":{},"files":[],"references":[{"path":"./common"},{"path":"./server"}]},"resolved":{"compileOnSave":false,"configFileSpecs":{"filesSpecs":[],"wildcardDirectories":{}},"errors":[],"fileNames":[],"options":{"configFilePath":"/js/tsconfig.json","declaration":false,"inlineSourceMap":false,"inlineSources":true,"module":1,"noEmit":false,"outDir":"$$ts-jest$$","removeComments":false,"sourceMap":true,"target":1},"projectReferences":[{"originalPath":"./common","path":"/js/common"},{"originalPath":"./server","path":"/js/server"}],"raw":{"compileOnSave":false,"compilerOptions":{},"files":[],"references":[{"path":"./common"},{"path":"./server"}]},"typeAcquisition":{"enable":false,"exclude":[],"include":[]},"wildcardDirectories":{}}},"version":"24.0.2"},"message":"normalized typescript config","sequence":18,"time":"2019-05-26T04:27:29.145Z"}{"context":{"fileName":"/js/server/src/Product.ts","logLevel":20,"namespace":"jest-transformer","package":"ts-jest","transformOptions":{"config":{"automock":false,"browser":false,"cache":true,"cacheDirectory":"/tmp/jest_0","clearMocks":true,"coveragePathIgnorePatterns":["/node_modules/"],"cwd":"/js","dependencyExtractor":null,"detectLeaks":false,"detectOpenHandles":false,"displayName":"SERVER","errorOnDeprecated":false,"filter":null,"forceCoverageMatch":[],"globalSetup":null,"globalTeardown":null,"globals":{"ts-jest":{"tsConfig":"tsconfig.json"}},"haste":{"computeSha1":false,"providesModuleNodeModules":[],"throwOnModuleCollision":false},"moduleDirectories":["node_modules"],"moduleFileExtensions":["js","json","jsx","ts","tsx","node"],"moduleNameMapper":{},"modulePathIgnorePatterns":[],"name":"524dcda91d222f1438dacdc6254406cd","prettierPath":"prettier","resetMocks":false,"resetModules":false,"resolver":null,"restoreMocks":false,"rootDir":"/js/server","roots":["/js/server/src"],"runner":"jest-runner","setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"snapshotSerializers":[],"testEnvironment":"/js/node_modules/jest-environment-node/build/index.js","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":["**/__spec__/**/*.ts","**/?(*.)spec.ts"],"testPathIgnorePatterns":["/node_modules/"],"testRegex":[],"testRunner":"/js/node_modules/jest-jasmine2/build/index.js","testURL":"http://localhost","timers":"real","transform":[["^.+\\.tsx?$","/js/node_modules/ts-jest/dist/index.js"]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]},"instrument":false,"rootDir":"/js/server"},"transformerId":1,"version":"24.0.2"},"message":"computing cache key for /js/server/src/Product.ts","sequence":19,"time":"2019-05-26T04:27:29.148Z"}
Issue :
Importing and using a mixin from a package in the same yarn workspace shows error
TypeError: Class constructor cannot be invoked without 'new'
Expected behavior :
should not error.
should behave identically to running tools separately. i.e.
configuring jest to point to the build folder output of tsc (instead of src) and running the following produces no errors:
tsc -b .
jest
One strange thing is that the types generated related to mixins applied base class imported from a different package and mixin defined in the same package are slightly different. (File: server/build/Product.d.ts). Everything else seems to be the exact same.
Debug log:
log file content
Minimal repo :
https://github.com/nullxone/tmp-ts-jest-import-mixin-constructor-error
It includes a comparison to defining the mixin in the same package, which does not error.
Related?
#571__
The text was updated successfully, but these errors were encountered: