Closed as not planned
Description
🚀 Feature Proposal
export JestAssertionError from expect to allow other packages to import it. This is a clone of #9919 as it's still relevant I think?
Motivation
Given that the expect package is modular and published as a standalone package on npm, I'm using it outside of jest and outside of tests. I'm currently trying to use it for implementing a custom mock server for a dev environment. To properly implement this, I need to distinguish expect exceptions from other exceptions, and thus need to do
if (err instanceof JestAssertionError) {}
However this is not currently possible seen as I can't import JestAssertionError from expect
Example
if (err instanceof JestAssertionError) {
res.status(400).end()
} else {
res.status(500).end()
}
Example
It can't come from anywhere else
Pitch
It can't come from anywhere else