Skip to content

fix: test tags options should overwrite inherited suite options + inherit suite options in task API#10216

Merged
sheremet-va merged 4 commits intovitest-dev:mainfrom
hi-ogawa:fix-test-tags-options-should-overwrite-inherited-suite-options
Apr 28, 2026
Merged

fix: test tags options should overwrite inherited suite options + inherit suite options in task API#10216
sheremet-va merged 4 commits intovitest-dev:mainfrom
hi-ogawa:fix-test-tags-options-should-overwrite-inherited-suite-options

Conversation

@hi-ogawa
Copy link
Copy Markdown
Collaborator

@hi-ogawa hi-ogawa commented Apr 28, 2026

Description

I was reviewing #10203 and it looks like grabbing collectorContext.currentSuite?.options seems like a right fix. Here is why:


This fixes suite option merging during test collection. Tests now merge options in the intended priority order:

inherited suite options < then tag-derived options < explicit task options.

This ensures tag options can override inherited suite defaults while still allowing the test’s own options to win.

By using collectorContext.currentSuite?.options inside task function, this also makes the advanced raw task API consistent with normal test() collection: tasks registered through TestRunner.getCurrentSuite().task(...) now inherit options from the current suite. This matches the documented custom task collector behavior that should act like a test collector. Notably some properties are already inherited based on context such as task.meta.

A regression test was added for custom task collectors using the raw task API to verify inherited concurrent, repeats, retry, and timeout options.

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.
  • Please check Allow edits by maintainers to make review process faster. Note that this option is not available for repositories that are owned by Github organizations.

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
Copy Markdown

netlify Bot commented Apr 28, 2026

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 1d845fd
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/69f0102323c0ce0008ea8175
😎 Deploy Preview https://deploy-preview-10216--vitest-dev.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 project configuration.

@hi-ogawa hi-ogawa marked this pull request as ready for review April 28, 2026 01:53
@hi-ogawa hi-ogawa changed the title fix: test tags options should overwrite inherited suite options + inherit suite options in raw task API fix: test tags options should overwrite inherited suite options + inherit suite options in task API Apr 28, 2026
@sheremet-va sheremet-va merged commit 457db29 into vitest-dev:main Apr 28, 2026
19 of 20 checks passed
@hi-ogawa hi-ogawa deleted the fix-test-tags-options-should-overwrite-inherited-suite-options branch April 28, 2026 07:09
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.

test.tags options doesn't overwrite inherited suite options

2 participants