Skip to content

feat: provide ctx.signal #7878

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

Merged
merged 18 commits into from
May 5, 2025
Merged

Conversation

sheremet-va
Copy link
Member

@sheremet-va sheremet-va commented Apr 23, 2025

Description

Fixes #7647

This PR provides a signal value to the test context. Signal can be aborted by Vitest when:

  • Current run is aborted with CTRL+C
  • Test times out
  • --bail cancels test run

Test plan:

  1. timeout in a normal test aborts the signal
  2. timeout in multiple concurrent tests aborts all signals
  3. cancelCurrentRun aborts the signal in a single test
  4. cancelCurrentRun aborts the signal in a multiple concurrent tests

@sheremet-va sheremet-va added this to the 3.2.0 milestone Apr 23, 2025
@sheremet-va sheremet-va marked this pull request as ready for review April 24, 2025 15:13
@sheremet-va sheremet-va added the p2-nice-to-have Not breaking anything but nice to have (priority) label Apr 24, 2025
@sheremet-va sheremet-va moved this to P2 - 5 in Team Board Apr 24, 2025
@sheremet-va sheremet-va requested a review from AriPerkkio April 24, 2025 15:13
Copy link

netlify bot commented Apr 24, 2025

Deploy Preview for vitest-dev ready!

Name Link
🔨 Latest commit ce6c13b
🔍 Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/6818c82da5eade0008c7321a
😎 Deploy Preview https://deploy-preview-7878--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 site configuration.

Copy link
Member

Choose a reason for hiding this comment

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

Great test cases! 🤩

@sheremet-va sheremet-va moved this from P2 - 5 to Approved in Team Board May 1, 2025
@sheremet-va sheremet-va merged commit e761f27 into vitest-dev:main May 5, 2025
6 checks passed
@sheremet-va sheremet-va deleted the feat/provide-signal branch May 5, 2025 14:16
deot added a commit to deot/http that referenced this pull request May 29, 2025
vitest-dev/vitest#7878 后续升级至3.2.0可移除
deot added a commit to deot/http that referenced this pull request May 29, 2025
deot added a commit to deot/http that referenced this pull request May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

AbortSignal in tests on run cancel
2 participants