I am a beginner of SinonJs, When I try to write some demo code, it cannot work, I don't know why.
app.js const db = require('./db');
module.exports.signUpUser = (user) => {
db.saveUser(user.email, user.password);
}
app.test.js
const sinon = require('sinon');
// without any other codes, it will throw Error: Cannot find module '@sinonjs/referee-sinon'
I user mocha to run the tests.
package.json
{
"name": "sinon-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "mocha **/*.test.js"
},
"author": "",
"license": "ISC",
"devDependencies": {
"mocha": "^5.2.0",
"sinon": "^7.2.3"
}
}