Skip to content

fix(browser): fix browser testing url for https#4855

Merged
sheremet-va merged 24 commits intovitest-dev:mainfrom
hi-ogawa:fix-browser-https
Jan 16, 2024
Merged

fix(browser): fix browser testing url for https#4855
sheremet-va merged 24 commits intovitest-dev:mainfrom
hi-ogawa:fix-browser-https

Conversation

@hi-ogawa
Copy link
Copy Markdown
Collaborator

@hi-ogawa hi-ogawa commented Jan 3, 2024

Description

Closes #4844

I used ViteDevServer.resolvedUrls to grab the url for browser testing. I think this should be always available and If this is not available, then it's probably a Vite bug, so I didn't put any fallback or validation here.

On a related note, currently Vite's base config is not supported yet (as reported in #4686), but ViteDevServer.resolvedUrls will be also generated according to base config, so I think treating resolvedUrls as a single source of truth is appropriate for browser testing.
(Actually base doesn't change browser testing url since it's always root /, but I guess it would still make sense to use resolvedUrls as a way to get origin.)

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:.

Loading
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.

vitest Browser Mode doesn't cooperate with local server configured for HTTPS

2 participants