运行测试文件时,我的测试通过了,但是beforeEach挂钩失败,并显示消息Uncaught TypeError: this.buf.latin1Write is not a function
我添加了testdouble,并将replace和require移到了before钩子内。
const td = require('testdouble');
suite('test', function() {
// This is what fails
setup(function() {
sentry = td.replace('../../../lib/sentry');
errors = require('../../../lib/errors');
});
suite('another test', function() {
test('', function() {
// some assertions here
})
});
});