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(testing): do not set vitest root when not in workspaceRoot #14362

Merged

Conversation

barbados-clemens
Copy link
Contributor

Current Behavior

when running vitest in the project root no tests are found as it's looks in an invalid path. {workspaceRoot}/{projectRoot}/{projectRoot}

Expected Behavior

vitest does not search in an invalid path (extra {projectRoot} appended to the path).

The change will set the vitest root to the project root being tested if the ExecutorContext#cwd is the workspaceRoot otherwise it will be set to an empty string letting vitest set the root to the current process.cwd

Related Issue(s)

Fixes #14208

@vercel
Copy link

vercel bot commented Jan 13, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated
nx-dev ⬜️ Ignored (Inspect) Jan 20, 2023 at 9:33PM (UTC)

@jaysoo jaysoo enabled auto-merge (squash) January 13, 2023 20:37
@nx-cloud
Copy link

nx-cloud bot commented Jan 13, 2023

☁️ Nx Cloud Report

CI is running/has finished running commands for commit ceb9898. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


🟥 Failed Commands
nx affected --target=e2e --base=1c3ebfc055e2c4bf59a32e6a589c585784957d6f --head=6738c39e70df2ad14b78462bc70a1975196a482c --exclude=e2e-storybook,e2e-storybook-angular --parallel=1
✅ Successfully ran 14 targets

Sent with 💌 from NxCloud.

@barbados-clemens barbados-clemens added the scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx label Jan 20, 2023
@barbados-clemens barbados-clemens merged commit 7857ae0 into nrwl:master Jan 20, 2023
FrozenPandaz pushed a commit that referenced this pull request Jan 20, 2023
@barbados-clemens barbados-clemens deleted the fix/vitest-root-offset branch January 23, 2023 15:29
@github-actions
Copy link

github-actions bot commented Mar 8, 2023

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@nrwl/vite:test won't run correctly when not in monorepo root
2 participants