fix(watch): don't indicate exit when no matching files#6968
fix(watch): don't indicate exit when no matching files#6968AriPerkkio wants to merge 2 commits intovitest-dev:mainfrom
Conversation
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
4c7f1d5 to
b82e5ea
Compare
|
|
||
| if (!this.config.watch || !(this.config.changed || this.config.related?.length)) { | ||
| if (this.config.watch) { | ||
| this.report('onFinished', [], []) |
There was a problem hiding this comment.
I feel like this breaks the lifecycle. There is usually at least onPathsCollected/onSpecsCollected call and onCollected
There was a problem hiding this comment.
Yup, currently this is getting stuck in onInit which also breaks the lifecycle.
What would be better approach here? Should we call reporters' onInit after length of files has been checked?
There was a problem hiding this comment.
I think that would be a big breaking change, the assumption now is that we always call onInit. Maybe we shouldn't start timers in onInit?
There was a problem hiding this comment.
Not sure what test reporters do with onInit in cases where test run didn't start. If we started timers in next onPathsCollected hook, we would get faster runs times in summary 😄
Looks like the internal junit reporter opens fs handle in onInit and closes it in onFinish. That logic sounds good to me. It's quite unexpected that onFinished is never called after onInit.
| this.logger.printNoTestFound(filters) | ||
|
|
||
| if (!this.config.watch || !(this.config.changed || this.config.related?.length)) { | ||
| if (this.config.watch) { |
There was a problem hiding this comment.
this.globTestFiles can now also throw an error if you specify the : incorrectly and the banner won't disappear:
vitest some-test:10
There was a problem hiding this comment.
It can also throw if git is not initialised and --changed flag is used
|
Maybe after #7069 this could be solved |
Description
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.