Skip to content

New tsconfig loading feature doesn't respect tsconfig extends #495

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

Closed
RhodeHummel opened this issue Aug 29, 2022 · 4 comments · Fixed by #502
Closed

New tsconfig loading feature doesn't respect tsconfig extends #495

RhodeHummel opened this issue Aug 29, 2022 · 4 comments · Fixed by #502
Assignees
Labels

Comments

@RhodeHummel
Copy link

RhodeHummel commented Aug 29, 2022

The new tsconfig loading feature implemented in #471 doesn't properly support extended tsconfig files. For example take the following config for our test files that extends our base config:

tests/tsconfig.json

{
  "extends": "../tsconfig.json",
  "include": [
    "./**/*.ts"
  ],
}

tsconfig.json

{
  "compilerOptions": {
    /* shared compiler options set here */
  }
  "include": {
    "src/**/*.ts",
    "src/**/*.vue"
  }
}

When the tests are run the config that is loaded and passed to the typescript compiler doesn't include any of the options set in the base config even though tests/tsconfig.json properly extends it. Note this was working previously before this PR was merged.

It looks like this was an issue in the past as well but was fixed and now has appeared again.
#118
#139

@nogic1008 nogic1008 self-assigned this Aug 29, 2022
@nogic1008 nogic1008 added the bug label Aug 29, 2022
@christianopaets
Copy link

I found a strange behaviour with tsconfig too.

I've added to jest config my tsconfig.spec.json that extends base tsconfig.json, and it works as I expected

globals: {
  'vue-jest': {
    tsConfig: './tsconfig.spec.json'
  }
}

@Rocik
Copy link

Rocik commented Oct 7, 2022

I can confirm that as well.
Works with what @christianopaets showed together with copying compilerOptions of root config.

@thebanjomatic
Copy link
Contributor

I have also run into this same problem and wound up implementing my own vue-ts-transformer to override the vue-jest default handling for ts script blocks. My version is just using typescript.getParsedCommandLineOfConfigFile from the typescript library itself to load the config file, and passing the parsed config into typescript.transpileModule

I can see about putting up a PR to make that change upstream.

thebanjomatic pushed a commit to thebanjomatic/vue-jest that referenced this issue Oct 11, 2022
A change introduced in v28.1.0 in PR vuejs#471 unintentionally changed the behavior of the tsconfig parsing such that configs using "extends" were no longer being considered.

Fixes: vuejs#495
thebanjomatic pushed a commit to thebanjomatic/vue-jest that referenced this issue Oct 11, 2022
A change introduced in v28.1.0 in PR vuejs#471 unintentionally changed the behavior of the tsconfig parsing such that configs using "extends" were no longer being considered.

Fixes: vuejs#495
thebanjomatic pushed a commit to thebanjomatic/vue-jest that referenced this issue Oct 11, 2022
A change introduced in v28.1.0 in PR vuejs#471 unintentionally changed the behavior of the tsconfig parsing such that configs using "extends" were no longer being considered.

Fixes: vuejs#495
thebanjomatic pushed a commit to thebanjomatic/vue-jest that referenced this issue Oct 11, 2022
A change introduced in v28.1.0 in PR vuejs#471 unintentionally changed the behavior of the tsconfig parsing such that configs using "extends" were no longer being considered.

Fixes: vuejs#495
thebanjomatic pushed a commit to thebanjomatic/vue-jest that referenced this issue Nov 1, 2022
A change introduced in v28.1.0 in PR vuejs#471 unintentionally changed the behavior of the tsconfig parsing such that configs using "extends" were no longer being considered.

Fixes: vuejs#495
lmiller1990 pushed a commit that referenced this issue Nov 3, 2022
* fix(tsconfig): parse extended tsconfigs when transpiling script blocks

A change introduced in v28.1.0 in PR #471 unintentionally changed the behavior of the tsconfig parsing such that configs using "extends" were no longer being considered.

Fixes: #495

* chore(cache): cache tsconfig parsing to avoid the cost per vue file / interpolated string

Co-authored-by: Adam Hines <ahines@factset.com>
@Hyzual
Copy link

Hyzual commented Nov 3, 2022

Thanks @thebanjomatic @lmiller1990, v29.2.0 solved our issues with tsconfig extends !

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

Successfully merging a pull request may close this issue.

6 participants