jest-codemods
jest-codemods copied to clipboard
Chai-should produced bad translation of chained property an
The chai-should codemod produces a bad result when chaining property with a/an. See this diff produced:
expect( state )
- .to.have.property( 'example.wordpress.com' )
- .to.be.a( 'object' );
+ .expect( typeof state ).toBe( 'object' );
See failing tests with proposed codemod result in #92
Detected in https://github.com/Automattic/wp-calypso/pull/19631 by @gziolo
@sirreal thanks for reporting this! And thanks for the failing test.
You bet! Thanks for your work on the codemods 😀
Chaining is currently unsupported in the chai-should... But it should be possible to add, like we did in the expect codemod. : )