-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
feat: workspaceIssues and PRs related to the workspace featureIssues and PRs related to the workspace feature
Description
Describe the bug
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.
Reproduction
-
Clone this repository & install dependencies (or use Stackblitz):
git clone https://github.com/maxpatiiuk/vitest-wrong-cwd cd vite-wrong-cwd npm install -
Run
npx vitest runfrom monorepo root. See that thevite.config.tsis correctly executed with CWD set to package root. At the same time,globalSetupscript is unexpectedly executed with CWD set to the monorepo root.
System Info
System:
OS: macOS 14.7
CPU: (10) arm64 Apple M1 Pro
Memory: 501.66 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.16.0 - ~/.nvm/versions/node/v20.16.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v20.16.0/bin/yarn
npm: 10.8.1 - ~/.nvm/versions/node/v20.16.0/bin/npm
pnpm: 8.9.0 - ~/.nvm/versions/node/v20.16.0/bin/pnpm
Browsers:
Chrome: 129.0.6668.100
Safari: 18.0.1
npmPackages:
vite: 5.4.8 => 5.4.8
vitest: 2.1.2 => 2.1.2Used Package Manager
npm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feat: workspaceIssues and PRs related to the workspace featureIssues and PRs related to the workspace feature
Type
Projects
Status
Rejected