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(browser): apply inlined workspace config to browser mode vite server #4947

Merged

Conversation

hi-ogawa
Copy link
Contributor

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

Description

Closes #4744

For non browser project, inlined workspace project config is included into vite server config via spreading during initializeProject:

const config: ViteInlineConfig = {
...options,
root,
logLevel: 'error',
configFile,
// this will make "mode": "test" | "benchmark" inside defineConfig
mode: options.test?.mode || options.mode || ctx.config.mode,
plugins: [
...options.plugins || [],
WorkspaceVitestPlugin(project, { ...options, root, workspacePath }),
],
}

However, browser mode's additional vite server instantiation was missing such logic, which leads to an issue when users relies on root workspace config without dedicated vite/vitest config file for the browser test project.

In this PR, I copied over only test: ..., but maybe it should spread everything like initializeProject does above since otherwise it would still miss inlined base vite config. (EDIT: I did so in aff160d)

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

Copy link

netlify bot commented Jan 13, 2024

Deploy Preview for fastidious-cascaron-4ded94 canceled.

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

@hi-ogawa hi-ogawa changed the title fix(browser): apply inline workspace test config to browser mode vite server fix(browser): apply inlined workspace test config to browser mode vite server Jan 13, 2024
@hi-ogawa hi-ogawa changed the title fix(browser): apply inlined workspace test config to browser mode vite server fix(browser): apply inlined workspace config to browser mode vite server Jan 13, 2024
@hi-ogawa hi-ogawa marked this pull request as ready for review January 13, 2024 07:03
@sheremet-va sheremet-va merged commit db01f6c into vitest-dev:main Jan 15, 2024
17 of 19 checks passed
@hi-ogawa hi-ogawa deleted the fix-browser-inline-workspace-config branch January 17, 2024 03:14
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.

Module aliases fail to resolve in workspace setup with browser config
2 participants