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(workspace): support overring pool and poolOptions on project level #4765

Merged

Conversation

AriPerkkio
Copy link
Member

@AriPerkkio AriPerkkio commented Dec 17, 2023

Description

Adds support for specifying following options in workspace projects configurations:

  • pool
  • poolOptions.threads.isolate
  • poolOptions.threads.singleThread
  • poolOptions.vmThreads.isolate
  • poolOptions.forks.isolate
  • poolOptions.forks.singleFork

Example:

import { defineWorkspace } from 'vitest/config'

export default defineWorkspace([
  {
    // Tests with side effects - require isolation
    test: {
      name: 'DOM tests',
      include: ['./src/web/**'],
    },
  },
  {
    // Tests that don't have side effects - can be run without isolation
    test: {
      name: 'Side-effect free unit tests',
      include: ['./src/utils/**'],
      poolOptions: { 
        threads: {
          singleThread:  true,
          isolate: false
        }
      },
    },
  },
  {
    // Tests that require forks pool for compatibility reasons
    test: {
      name: 'Database tests',
      include: ['./src/db/**'],
      pool: 'forks',
    },
  },
])

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

Sorry, something went wrong.

Copy link

netlify bot commented Dec 17, 2023

Deploy Preview for fastidious-cascaron-4ded94 ready!

Name Link
🔨 Latest commit 965dbaf
🔍 Latest deploy log https://app.netlify.com/sites/fastidious-cascaron-4ded94/deploys/659c2c69c667280009e54c48
😎 Deploy Preview https://deploy-preview-4765--fastidious-cascaron-4ded94.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@AriPerkkio AriPerkkio force-pushed the fix/workspaces-pool-options branch from bebc674 to 7ce2d23 Compare December 27, 2023 18:00
@AriPerkkio AriPerkkio force-pushed the fix/workspaces-pool-options branch 3 times, most recently from da84284 to bb377ed Compare December 29, 2023 15:33
@AriPerkkio AriPerkkio marked this pull request as ready for review December 29, 2023 16:00
@AriPerkkio AriPerkkio force-pushed the fix/workspaces-pool-options branch 3 times, most recently from d1c64ca to d7fa28a Compare January 1, 2024 13:29
@AriPerkkio AriPerkkio force-pushed the fix/workspaces-pool-options branch from d7fa28a to 965dbaf Compare January 8, 2024 17:10
@sheremet-va sheremet-va merged commit e9fe418 into vitest-dev:main Jan 9, 2024
@AriPerkkio AriPerkkio deleted the fix/workspaces-pool-options branch January 9, 2024 16:47
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.

Make it possible to override pool and poolOptions per workspace
2 participants