Skip to content

Conversation

@9aoy
Copy link
Contributor

@9aoy 9aoy commented Oct 13, 2025

Summary

should handle error string correctly.

image

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings October 13, 2025 11:03
@netlify
Copy link

netlify bot commented Oct 13, 2025

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit 00d0eb1
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/68ecdc78edf97b000868722a
😎 Deploy Preview https://deploy-preview-614--rstest-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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes error string handling in the test runtime to prevent crashes when tests reject with string values instead of Error objects.

  • Adds string error handling in the formatTestError function to wrap string errors in an object with a message property
  • Adds end-to-end test coverage for error string scenarios
  • Updates migration documentation to include error handling examples

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/core/src/runtime/util.ts Modified formatTestError to handle string errors by wrapping them in error objects
e2e/test-api/fixtures/errorString.test.ts Added test fixture that rejects with a string to reproduce the bug
e2e/test-api/edgeCase.test.ts Added test case to verify string error handling works correctly
website/docs/en/guide/migration/jest.mdx Added documentation example for error handling in async tests
website/docs/zh/guide/migration/jest.mdx Added Chinese translation of error handling documentation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


it('test error string', () => {
return new Promise((_resolve, reject) => {
reject('aaaa');
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

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

[nitpick] The error message 'aaaa' is a magic string that doesn't provide meaningful context. Consider using a more descriptive error message like 'Test error string' to make the test intention clearer.

Suggested change
reject('aaaa');
reject('Test error string');

Copilot uses AI. Check for mistakes.
@9aoy 9aoy merged commit fa16ea8 into main Oct 14, 2025
54 of 67 checks passed
@9aoy 9aoy deleted the error-string branch October 14, 2025 03:28
@9aoy 9aoy mentioned this pull request Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants