Jest正在报道:
TypeError: Cannot read property 'getFileName' of undefined
at Function.write (../../../AppData/Roaming/npm/node_modules/jest/node_modules/jest-util/build/buffered_console.js:33:24)
当我这样做时:
test('wrap template', () => {
expect.assertions(1)
return generate(_cwd)
.then(done => {
let builtPageName = path.basename(done.shift())
expect(builtPageName).toBe('indx.html')
})
.catch(console.error)
})
但是当我删除.catch(console.error)
时,它就像往常一样打印出来:
expect(received).toBe(expected)
Expected value to be (using ===):
"indx.html"
Received:
"index.html"
at generate.then.done (lib/__tests__/template.test.js:25:27)
现在,我希望从测试工具中看到这份报告。
那么,当使用/不使用.catch(...)
运行测试用例时会发生什么?
我在node 6.11.2
处运行npm 5.4.0
,jest 21.1.0
和Windows 7
。