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(cli): allow user to override reporter via cli option #721

Closed
wants to merge 1 commit into from

Conversation

11joselu
Copy link
Contributor

@11joselu 11joselu commented Feb 9, 2022

I think after this changes #702 we are not able to override vitest reporter via cli options. Always use default

To test it

npx vitest --api -r test/core --reporter dot

@netlify
Copy link

netlify bot commented Feb 9, 2022

✔️ Deploy Preview for vitest-dev ready!

🔨 Explore the source changes: fcb5c58

🔍 Inspect the deploy log: https://app.netlify.com/sites/vitest-dev/deploys/6204236fb6e810000827a150

😎 Browse the preview: https://deploy-preview-721--vitest-dev.netlify.app

@11joselu 11joselu changed the title Fix: allow user to override reporter via cli option fix(cli): allow user to override reporter via cli option Feb 9, 2022
@@ -61,9 +61,10 @@ export class Vitest {
this.state = new StateManager()
this.snapshot = new SnapshotManager(resolved)
// @ts-expect-error cli type
this.reporters = toArray(resolved.reporters || resolved.reporter)
this.reporters = toArray(resolved.reporter || resolved.reporters)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we directly use resolved.reporters here and overwrite it with reporter inside resolveConfig?

Copy link
Contributor Author

@11joselu 11joselu Feb 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are (I think) 3 possibles solution)

  • current propossal
  • your propossal solution (makes sense to me too)
  • rename cli option from reporter to reporters (because with this change fix: default reporters should be an array #720 reporters could be now an array of reporters (make sense that?))

What is the best solution here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should keep the default of the reporters option empty and resolve them in resolveConfig. When the array is empty, append default to it.

@antfu antfu closed this in f9353f4 Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants