Skip to content

fix(cli): parse --browser=<name> correctly#5179

Merged
sheremet-va merged 2 commits intovitest-dev:mainfrom
AriPerkkio:fix/browser-cli-option
Feb 12, 2024
Merged

fix(cli): parse --browser=<name> correctly#5179
sheremet-va merged 2 commits intovitest-dev:mainfrom
AriPerkkio:fix/browser-cli-option

Conversation

@AriPerkkio
Copy link
Member

@AriPerkkio AriPerkkio commented Feb 10, 2024

Description

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

@netlify
Copy link

netlify bot commented Feb 10, 2024

Deploy Preview for fastidious-cascaron-4ded94 canceled.

Name Link
🔨 Latest commit 4e6ba96
🔍 Latest deploy log https://app.netlify.com/sites/fastidious-cascaron-4ded94/deploys/65c9b3b47f1a38000815ebcb

@AriPerkkio AriPerkkio marked this pull request as ready for review February 10, 2024 13:56
@AriPerkkio
Copy link
Member Author

/ecosystem-ci run

@vitest-ecosystem-ci
Copy link

vitest-ecosystem-ci bot commented Feb 10, 2024

📝 Ran ecosystem CI: Open

suite result
nuxt ✅ success
nuxt-test-utils ✅ success
vite ✅ success
vitest-sonar-reporter ✅ success
vitest-github-actions-reporter ✅ success
vitest-browser-simple ✅ success
vitest-coverage-large ✅ success
vitest-reporters-large ✅ success

Copy link
Contributor

@hi-ogawa hi-ogawa left a comment

Choose a reason for hiding this comment

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

I wonder how these case are handled now (and also before).

  • --browser=false
  • --browser false
  • --browser some-file.test.ts

Can you include these in tests?

@AriPerkkio AriPerkkio force-pushed the fix/browser-cli-option branch from 75be929 to fa65648 Compare February 12, 2024 05:41
@AriPerkkio
Copy link
Member Author

Added test cases for the --browser=false and --browser false. Not sure how --browser some-file.test.ts could be supported though.

@hi-ogawa
Copy link
Contributor

Just to clarify, I wasn't saying to support something like --browser some-file.test.ts but I was simply wondering the current and previous behaviors.

I would imagine it would be tricky to support that, so it's probably okay to treat it as { name: "some-file.test.ts" } for now?

@AriPerkkio
Copy link
Member Author

Looks like it doesn't work with the latest release either. Let's not do changes related to that for now. I'll revert that test case.

$ vitest --browser app.spec.ts

 DEV  v1.2.2 /x/y/z/browser-simple
      Browser runner started at http://localhost:5173/


⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error: [] Browser "app.spec.ts" is not supported by the browser provider "playwright". Supported browsers: firefox, webkit, chromium.

@AriPerkkio AriPerkkio force-pushed the fix/browser-cli-option branch from fa65648 to 4e6ba96 Compare February 12, 2024 05:59
@hi-ogawa
Copy link
Contributor

Maybe revert true/false handling too? It looks like it wasn't supported in the last release.

@sheremet-va
Copy link
Member

Maybe revert true/false handling too? It looks like it wasn't supported in the last release.

It was clearly a bug, and one of the reasons we are making changes to the CLI parsing is to fix those edge cases.

@sheremet-va sheremet-va merged commit 656e210 into vitest-dev:main Feb 12, 2024
@AriPerkkio AriPerkkio deleted the fix/browser-cli-option branch February 12, 2024 14:56
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.

3 participants