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

fix(vue3-jest): reduce getTypeScriptConfig calls #491

Merged
merged 2 commits into from
Aug 23, 2022

Conversation

nogic1008
Copy link
Collaborator

@nogic1008 nogic1008 commented Aug 21, 2022

⚠️This PR contains BREAKING CHANGES!!⚠️

In @vue/vue3-jest, getTypeScriptConfig calls every times whether project uses TypeScript or not.
With that, js users will get unnecessary "Not found tsconfig.json" warnings.
Fix #490

Changes

  • Restrict calling getTypeScriptConfig function to when using <script lang="ts">, <script lang="tsx">, or <script lang="typescript">.

Breaking Change

  • Even if there is a tsconfig.json file in project, TypeScript will not transpile if lang=ts is not specified
script tsconfig.json transpile
JavaScript No @babel/preset-env
TypeScript No @babel/preset-env (with "Not found tsconfig.json" warning)
JavaScript Yes typescript -> @babel/preset-env
TypeScript Yes typescript

typescript -> @babel/preset-env
@lmiller1990 lmiller1990 merged commit 4855375 into vuejs:master Aug 23, 2022
@lmiller1990
Copy link
Member

Thanks! Looks good.

FYI I think the convention for breaking is breaking: <commit message>.

@nogic1008 nogic1008 deleted the hotfix/vue3/tsconfig branch August 23, 2022 03:11
@sschneider-ihre-pvs
Copy link

ok, does that mean it is expected that there is a tsconfig.json? what if I have a tsconfig.spec.json instead?

@lmiller1990
Copy link
Member

Would have to check the code, but I guess we assume tsconfig.json.

We could add an option to specify the tsconfig in jest.config:

global: {
  'vue-jest': {
    tsconfig: ...
  }
}

@sschneider-ihre-pvs
Copy link

that would be cool because I have something like tsconfig.json, tsconfig.app.json and tsconfig.spec.json.

@sschneider-ihre-pvs
Copy link

you know, the default nx monorepo stuff :D

@lmiller1990
Copy link
Member

We can definitely accept a PR to this meaning. This code base is quite small, it should be fairly easy to add. Would you be interested in making this PR?

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

Successfully merging this pull request may close these issues.

Not found tsconfig.json warning in log
3 participants