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
The literal notation of a regular expression in JavaScript is still a RegExp object. But The prefer-to-be rule treats literal notation as a literal. So it auto-fixes .toStrictEqual into .toBe, causing tests to fail.
For example, given two tests that pass:
it('is an example',()=>{consttoken: RegExp=newRegExp('[abc]+','gu');expect(token).toStrictEqual(/[abc]+/gu);expect(token).toStrictEqual(newRegExp('[abc]+','gu'));});
Is changed into:
it('is an example',()=>{consttoken: RegExp=newRegExp('[abc]+','gu');expect(token).toBe(/[abc]+/gu);expect(token).toStrictEqual(newRegExp('[abc]+','gu'));});
And the .toBe test fails
The text was updated successfully, but these errors were encountered:
The literal notation of a regular expression in JavaScript is still a
RegExp
object. But Theprefer-to-be
rule treats literal notation as a literal. So it auto-fixes.toStrictEqual
into.toBe
, causing tests to fail.For example, given two tests that pass:
Is changed into:
And the
.toBe
test failsThe text was updated successfully, but these errors were encountered: