question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

tsconfig.json with no compilerOptions causes typescript-compiler to error

See original GitHub issue

I 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:open
  • Created 3 years ago
  • Reactions:2
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lmiller1990commented, Jan 19, 2021

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.

0reactions
lmiller1990commented, Jan 21, 2021

Just do yarn add vue-jest@4 and grab the latest one, beta something.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found