未捕获的TypeError:this.buf.latin1Write不是函数

时间:2019-05-31 23:23:07

标签: node.js html-table mocha testdoublejs

运行测试文件时,我的测试通过了,但是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
    })
  });
});

0 个答案:

没有答案