Mongoose model (Issue của bạn ) trả về một phiên bản mới của Query sự vật. Query mới cá thể có quyền truy cập vào exec thông qua prototype . (mongoose 3,8 ~)
Nếu bạn muốn trả lại một lỗi, bạn có thể viết:
sinon.stub(mongoose.Query.prototype, "exec").yields({ name: "MongoError" }, null);