This is a jscodeshift codemod that helps transforms legacy should
tests to Jest's expect
format. Tests are automatically run via a Github Actions workflow.
yarn jscodeshift \
-t index.js \
file-to-transform.js
should(something.nested).match(/foo/i);
should.exist(foo);
should.not.exist(foo);
foo(bar)[0].should.match(/bar/);
err.problems[0].should.match(/oopsies/i);
expect(something.nested).toMatch(/foo/i);
expect(foo).toBeDefined();
expect(foo).not.toBe(expect.anything());
expect(foo(bar)[0]).toMatch(/bar/);
expect(err.problems[0]).toMatch(/oopsies/i);
The latest supported methods are always located in __testfixtures__/should-to-jest.input.js. The transformed output is located in __testfixtures__/should-to-jest.output.js
yarn test
yarn test:watch