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(cli): handle run mode correctly (fix #719) #717
Conversation
✔️ Deploy Preview for vitest-dev ready! 🔨 Explore the source changes: 8544bf5 🔍 Inspect the deploy log: https://app.netlify.com/sites/vitest-dev/deploys/62042046fe2e9f000803c839 😎 Browse the preview: https://deploy-preview-717--vitest-dev.netlify.app |
@@ -49,6 +49,7 @@ export const configDefaults: UserConfig = Object.freeze({ | |||
isolate: true, | |||
watchIgnore: [/\/node_modules\//, /\/dist\//], | |||
update: false, | |||
run: !!process.env.CI, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix should be make watch default to false and handles it in CLI, /cc @sheremet-va
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed
|
||
cli | ||
.command('[...filters]') | ||
.action(dev) | ||
.action(run) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep the original naming? I found them a bit confusing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we don't really need the dev
function anymore I now inlined the option overrides of vitest run
.
@@ -56,7 +56,7 @@ export async function VitestPlugin(options: UserConfig = {}, ctx = new Vitest()) | |||
options, | |||
) | |||
options.api = resolveApiConfig(options) | |||
options.watch = options.watch && !options.run | |||
options.watch = !options.run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should keep the original logic.
There are some logic under dev
get removed in #702, we need to bring them back
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic of the dev
function that got removed in #702 isn't needed anymore.
It was just acting as a default value, which is now included in configDefaults
.
e2b2f02
to
8544bf5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix looks good after the discussion. It would be good to avoid the redundant booleans { run: true, watch: false }
, maybe a mode could be explored? A mode: 'watch' | 'run'
, like we have in vite with 'dev' | 'build'
.
Absolutely, the separate |
Closes #719