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.

Issue with Typescript project

See original GitHub issue

Issue is described here: https://github.com/nuxt/create-nuxt-app/issues/546

After a little digging, the problem is due to vue-jest@4.0.0-beta.3 If I replace it with vue-jest@4.0.0-beta.2, the issue disappears

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:6

github_iconTop GitHub Comments

7reactions
nogic1008commented, Jun 15, 2020

Error occurs here: https://github.com/vuejs/vue-jest/blob/master/lib/utils.js#L69

In ts-jest@25.5.0 and above, ConfigSet.typescript property has been renamed to parsedTsConfig. (BREAKING CHANGE) Ref: https://github.com/kulshekhar/ts-jest/commit/720c8546578bdbb3d6525581fbeffce82016dba5

However, this package specifies ^25.2.1, which includes v25.5 and later. ts-jest DOES NOT use SemVer for versioning. Therefore, version specification should be careful.

Workaround

Install ts-jest@25.4.0 explicitly

npm i -D vue-jest@4.0.0-beta.3 ts-jest@25.4.0

If you use Yarn, fix yarn.lock like this

ts-jest@^25.2.1:
  version "25.4.0"
  resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-25.4.0.tgz#5ad504299f8541d463a52e93e5e9d76876be0ba4"
  integrity sha512-+0ZrksdaquxGUBwSdTIcdX7VXdwLIlSRsyjivVA9gcO+Cvr6ByqDhu/mi5+HCcb6cMkiQp5xZ8qRO7/eCqLeyw==
  dependencies:
    bs-logger "0.x"
    buffer-from "1.x"
    fast-json-stable-stringify "2.x"
    json5 "2.x"
    lodash.memoize "4.x"
    make-error "1.x"
    micromatch "4.x"
    mkdirp "1.x"
    resolve "1.x"
    semver "6.x"
    yargs-parser "18.x"
1reaction
nogic1008commented, Jun 12, 2020

To solve this issue, we can take one of three approaches:

  1. Specify the version to use less than 25.5.
    • package.json
      -    "ts-jest": "^25.2.1"
      +    "ts-jest": ">=25.2.1 <25.5"
      
  2. bump ts-jest to 25.5.x in package.json, and fix lib/utils.js.
    • package.json
      -    "ts-jest": "^25.2.1"
      +    "ts-jest": "25.5.x"
      
    • lib/utils.js
      -  const { typescript } = tr.configsFor(config)
      -  return { compilerOptions: typescript.options }
      +  const { parsedTsConfig } = tr.configsFor(config)
      +  return { compilerOptions: parsedTsConfig.options }
      
  3. fix lib/utils.js to read parsedTsConfig or typescript property.
    • lib/utils.js
      -  const { typescript } = tr.configsFor(config)
      +  const configSet = tr.configsFor(config)
      +  const typescript = configSet.parsedTsConfig || configSet.typescript
      

What should I do?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common TypeScript module problems and how to solve them
Solution 1: Locate the correct directory ... When we use this configuration, TypeScript compiler “jumps” up a directory from the src directory and ......
Read more >
Issues · microsoft/TypeScript - GitHub
TypeScript is a superset of JavaScript that compiles to clean JavaScript output. ... Project with references but no input files fails to report...
Read more >
Documentation - Project References - TypeScript
Project references are a new feature in TypeScript 3.0 that allow you to structure your TypeScript programs into smaller pieces.
Read more >
TypeScript "Show project errors" not working correctly
Disable "show project errors" in TS Panel · Change a function name of a method in file1 that is used in other ts...
Read more >
Typescript problem after vs update - Visual Studio Feedback
Your project may be using TypeScript language features that will result in errors when compiling with this version of the TypeScript compiler. To...
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