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: support some virtual contexts in toThrow #1609

Merged
merged 3 commits into from May 9, 2024
Merged

Conversation

43081j
Copy link
Contributor

@43081j 43081j commented Feb 26, 2024

This adds support for VM situations where we pass a RegExp from another process.

Note that we don't have a full fix for this stuff until check-error also supports Error being from another origin.

There's also a tiny fix in here for supporting throw ''. I have left a PR comment by the relevant line of code

@43081j 43081j requested a review from a team as a code owner February 26, 2024 19:04
lib/chai/core/assertions.js Outdated Show resolved Hide resolved
keithamus
keithamus previously approved these changes Feb 26, 2024
Copy link
Member

@keithamus keithamus left a comment

Choose a reason for hiding this comment

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

LGTM

koddsson
koddsson previously approved these changes Feb 27, 2024
Copy link
Member

@koddsson koddsson left a comment

Choose a reason for hiding this comment

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

Looks good :)

lib/chai/utils/index.js Show resolved Hide resolved
This adds support for VM situations where we pass a `RegExp` from
another process.

Note that we don't have a full fix for this stuff until `check-error`
also supports `Error` being from another origin.
Adds support for throwing things like `undefined`, functions, etc.
@43081j 43081j dismissed stale reviews from koddsson and keithamus via 23b4dc2 May 4, 2024 17:53
@43081j
Copy link
Contributor Author

43081j commented May 4, 2024

@koddsson could you re-review this? i updated slightly to support throwing of anything (so even throw undefined will work)

and i wrapped getConstructorName in a try/catch since it may be possible we pass a non-constructable function to it in super weird cases

koddsson
koddsson previously approved these changes May 8, 2024
Copy link
Member

@koddsson koddsson left a comment

Choose a reason for hiding this comment

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

Looks good to me! I have one question but happy to merge whatever the answer to that is.

test/virtual-machines.js Outdated Show resolved Hide resolved
@43081j 43081j requested a review from koddsson May 9, 2024 07:48
@koddsson koddsson enabled auto-merge (squash) May 9, 2024 10:14
Copy link
Member

@koddsson koddsson left a comment

Choose a reason for hiding this comment

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

Looks good!

@koddsson koddsson merged commit 37263c0 into chaijs:main May 9, 2024
5 checks passed
@43081j 43081j deleted the virtuals branch May 9, 2024 10:18
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.

None yet

3 participants