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

workspace typecheck: tsconfig.vitest-temp.json is overridden if more workspace target the same folder with a different tsconfigs #7107

Closed
6 tasks done
marcalexiei opened this issue Dec 20, 2024 · 0 comments · Fixed by #7112

Comments

@marcalexiei
Copy link

Describe the bug

Using vitest.workspace.ts, I cycle through all the folders in the tests directory.
For each folder, I check for the existence of a file starting with tsconfig.
For each matching file, I create a workspace with test.typecheck.tsconfig referencing the corresponding config file.

Caution

When running vitest, I expect each case folder to contain two temporary tsconfig.vitest-temp files.
Currently, only one is present.

Note

It looks like that thetsconfig.vitest-temp.json name iswritten here:

const tempConfigPath = join(
dirname(tsconfig.path),
'tsconfig.vitest-temp.json',
)

Maybe the issue can be fixed by using the original filename alongside original-name-without-extenstion.vitest-temp.json?

The original issue was reported in i18next repository

Reproduction

I setup a small repository where the issue can be easily reproduced:
https://github.com/marcalexiei/vitest-typecheck-ts-config-reproduction

To show this behaviour I created a GitHub action.
An example run can be found at this page

When running the case-1 workspace, no errors are produced.
However when running case-1-noStrict workspace alone results in an error.

Running all workspaces produces inconsistent results:

  • No errors
  • Workspaces within the same folder show either errors or no errors, depending on which of the two tsconfig files is written in the temp file
  • Parsing errors occur with the tsconfig.vitest-temp.json file

System Info

System:
    OS: macOS 15.2
    CPU: (8) arm64 Apple M3
    Memory: 348.19 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.11.0 - ~/.nvm/versions/node/v22.11.0/bin/node
    npm: 10.9.0 - ~/.nvm/versions/node/v22.11.0/bin/npm
    pnpm: 9.15.0 - ~/.nvm/versions/node/v22.11.0/bin/pnpm
  Browsers:
    Chrome: 131.0.6778.205
    Safari: 18.2
  npmPackages:
    vitest: 2.1.8 => 2.1.8

Used Package Manager

pnpm

Validations

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
1 participant