tsconfig.json with no compilerOptions causes typescript-compiler to error
See original GitHub issueI had a tsconfig.json
with no compilerOptions
, which typescrpit explicitly allows (docs), and results in using the default values for all optoins.
When importing a .vue
file in my test, it would throw the following error:
● Test suite failed to run
TypeError: Cannot read property 'module' of undefined
at compileTypescript (node_modules/vue-jest/lib/compilers/typescript-compiler.js:19:32)
at processScript (node_modules/vue-jest/lib/process.js:23:12)
at Object.module.exports [as process] (node_modules/vue-jest/lib/process.js:42:18)
at ScriptTransformer.transformSource (node_modules/@jest/transform/build/ScriptTransformer.js:481:35)
at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:586:40)
at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:624:25)
If you look at the typescript-compiler.js
line it references, there is a clear use of tsConfig.compilerOptions.module
with no check whatsoever that compilerOptions
is defined, which causes the error.
I have since added a compilerOptions
field to my config for other reasons and it works fine now, but wanted to let you guys know!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:7 (3 by maintainers)
Top Results From Across the Web
TSConfig Reference - Docs on every TSConfig option
A TSConfig file in a directory indicates that the directory is the root of a TypeScript or JavaScript project... Compiler Options. Top Level....
Read more >Connecting typescript errors to their associated compiler ...
This SO post, Complete list of Typescript error codes and their fixes, provides a list of messages, but not with which compiler option...
Read more >TypeScript Compiling with Visual Studio Code
A tsconfig.json file defines the TypeScript project settings, such as the compiler options and the files that should be included. To do this,...
Read more >No inputs were found in config file in TypeScript | bobbyhadz
The error "No inputs were found in config file" occurs when we try to build a project that does not contain any TypeScript...
Read more >Troubleshooting | ts-node - TypeStrong · GitHub
Any error that is not a TSError is from node.js (e.g. SyntaxError ), and cannot be fixed by TypeScript or ts-node. These are...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We should update the latest version on npm… unsure why this hasn’t been done, I will need to see if there is any specific reason npm is sitting on 3.x (this repo was larger unmaintained for quite a while, I’m just picking this up).
You want 4.x for Vue 2 and 5.x for Vue 3. 3.x has not received an update in quite some time.
Just do
yarn add vue-jest@4
and grab the latest one, beta something.