Skip to content

Commit

Permalink
fix(vite): support passing --watch to inferred vitest commands (#23298)
Browse files Browse the repository at this point in the history
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
<!-- This is the behavior we have today -->
We currently do not handle passing `--watch` when running inferred
`vitest` commands

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
We should support handling `--watch`

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #23185
  • Loading branch information
Coly010 committed May 10, 2024
1 parent 613fdb0 commit 7cf09a6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exports[`@nx/vite/plugin root project should create nodes 1`] = `
"targets": {
"test": {
"cache": true,
"command": "vitest run",
"command": "vitest",
"inputs": [
"default",
"^production",
Expand All @@ -20,6 +20,7 @@ exports[`@nx/vite/plugin root project should create nodes 1`] = `
],
"options": {
"cwd": ".",
"watch": false,
},
"outputs": [
"{projectRoot}/coverage",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exports[`@nx/vite/plugin with test node root project should create nodes - with
"targets": {
"test": {
"cache": true,
"command": "vitest run",
"command": "vitest",
"inputs": [
"default",
"^production",
Expand All @@ -20,6 +20,7 @@ exports[`@nx/vite/plugin with test node root project should create nodes - with
],
"options": {
"cwd": ".",
"watch": false,
},
"outputs": [
"{projectRoot}/coverage",
Expand Down
4 changes: 2 additions & 2 deletions packages/vite/src/plugins/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ async function testTarget(
projectRoot: string
) {
return {
command: `vitest run`,
options: { cwd: joinPathFragments(projectRoot) },
command: `vitest`,
options: { cwd: joinPathFragments(projectRoot), watch: false },
cache: true,
inputs: [
...('production' in namedInputs
Expand Down

0 comments on commit 7cf09a6

Please sign in to comment.