Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Typescript project #245

Closed
lambda0xff opened this issue Jun 11, 2020 · 6 comments
Closed

Issue with Typescript project #245

lambda0xff opened this issue Jun 11, 2020 · 6 comments

Comments

@lambda0xff
Copy link

Issue is described here:
nuxt/create-nuxt-app#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

@nogic1008
Copy link
Collaborator

nogic1008 commented Jun 12, 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: kulshekhar/ts-jest@720c854

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"

@nogic1008
Copy link
Collaborator

nogic1008 commented 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?

@dawoe
Copy link

dawoe commented Jun 16, 2020

I was running into this issue as well... tried workaround one and that did fix the issue

@alecgerona
Copy link

I think sticking with version 3 is the safest bet. Would love to upgrade after beta is over.

@nogic1008
Copy link
Collaborator

solved by #246

@nogic1008
Copy link
Collaborator

@lambda0xff or maintainer
plz close this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants