Closed kairun closed 7 years ago
For anyone who is taking same path as me (who are migrating from Mocha & Mockery & Sinon & Chai towards Jest),
Jest offers their native version of require mocks, which removes any inconsistent mockery behaviours in the context of Jest,
such as:
jest does not support mocking non-existed file, for example different env getting different config.json
file, and all config.json
is needed testing on all env (for 100% coverage).
not sure if anyone meet the problem
Below code does not look work at all, I do not think I've made any mistakes here, but console still logs out the return from from original
aws-sdk
require call, not newly mocked{}
test.spec.js
strangely, this does work if