You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using vitest.workspace.ts file in a monorepo, the globalSetup script is executed with the CWD set to the monorepo root rather than the package root.
The vite.config.ts is correctly executed with the package root as CWD.
git clone https://github.com/maxpatiiuk/vitest-wrong-cwd
cd vite-wrong-cwd
Install dependencies
npm install
In VS Code with the "Vitest" extension installed, open the packages/calcite-components/src/utils/component.spec.ts file from this repository.
Open the "Output -> Vitest" panel in VS Code to see the log output for the "Vitest" extension. See that the globalSetup script is executed with the CWD set to the monorepo root rather than package root.
Output
[INFO 7:25:38 PM] [v1.6.0] Vitest extension is activated because Vitest is installed or there is a Vite/Vitest config file in the workspace.
[INFO 7:25:38 PM] [API] Running Vitest v2.1.2 (vitest-wrong-cwd/vitest.workspace.ts) with Node.js@v20.16.0: /Users/mak13180/.nvm/versions/node/v20.16.0/bin/node
[INFO 7:25:38 PM] [Worker] 🟥 vite.config.ts cwd: /Users/mak13180/site/esri/vitest-wrong-cwd/packages/calcite-components
[INFO 7:25:38 PM] [API] Vitest v2.1.2 (vitest-wrong-cwd/vitest.workspace.ts) child process 45982 created
[INFO 7:25:38 PM] [VSCODE] Watching vitest-wrong-cwd with pattern **/*
[INFO 7:25:45 PM] [API] Collecting tests: packages/calcite-components/src/utils/component.spec.ts
[INFO 7:25:45 PM] [Worker] 🟥 globalSetup.ts cwd: /Users/mak13180/site/esri/vitest-wrong-cwd
Version
v1.6.0
Validations
Check that you are using the latest version of the extension
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Describe the bug
When using
vitest.workspace.ts
file in a monorepo, theglobalSetup
script is executed with the CWD set to the monorepo root rather than the package root.The
vite.config.ts
is correctly executed with the package root as CWD.Reproduction
Reproduction repository: https://github.com/maxpatiiuk/vitest-wrong-dir
Clone the repository
git clone https://github.com/maxpatiiuk/vitest-wrong-cwd cd vite-wrong-cwd
Install dependencies
In VS Code with the "Vitest" extension installed, open the
packages/calcite-components/src/utils/component.spec.ts
file from this repository.Open the "Output -> Vitest" panel in VS Code to see the log output for the "Vitest" extension. See that the
globalSetup
script is executed with the CWD set to the monorepo root rather than package root.Output
Version
v1.6.0
Validations
The text was updated successfully, but these errors were encountered: