A Jest custom matcher that asserts a Spy or Stub was called on a given context, like sinon.calledOn
$ npm i jest-matcher-called-onIn <rootDir>/jest/customMatchers.js add the following
import calledOn from 'jest-matcher-called-on';
expect.extend(calledOn);Then in ./package.json add
"jest": {
"setupTestFrameworkScriptFile": "<rootDir>/jest/customMatchers.js"
}And use in your tests like
expect(spy).calledOn(obj);$ npm t$ npm run lintContributions and comments welcome.