You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Simply create the following test in your node env project:
import{AssertionError}from'assert'describe('AssertionError',()=>it('should extend the base Error class',()=>{constfoo=newAssertionError({})expect(fooinstanceofError).toBeTruthy()expect(foo).toBeInstanceOf(AssertionError)})})
Both assertions will fail even though in NodeJS v20 LTS the condition (foo instanceof Error) will resolve to true
Expected behavior
I expect AssertionErrors to extend the standard Error class as they do in the latest LTS version of NodeJS and pass instanceof checks.
Actual behavior
AssertionErrors do not extend the base Error class in NodeJS when running in a jest context.
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.
Version
29.7.0
Steps to reproduce
Use the following jest.config.js:
Simply create the following test in your
node
env project:Both assertions will fail even though in NodeJS v20 LTS the condition (foo instanceof Error) will resolve to
true
Expected behavior
I expect AssertionErrors to extend the standard Error class as they do in the latest LTS version of NodeJS and pass
instanceof
checks.Actual behavior
AssertionErrors do not extend the base Error class in NodeJS when running in a jest context.
Additional context
No response
Environment
The text was updated successfully, but these errors were encountered: