【发布时间】:2016-09-30 13:41:31
【问题描述】:
我正在使用 Jest 测试我的 Node.JS 应用程序,当我运行测试时,一些内置函数不起作用,似乎它们没有定义。例如,toContainEqual 和 toBeInstanceOf。
这是我的代码示例:
it('should delete DB entry', () => query(url, queryString)
.then(res => res.json()
.then(() => db.collection('exercises').find({}).toArray()))
.then(res => expect(res).toContainEqual(originalExercise)))
我得到的错误是:
TypeError: expect(...).toContainEqual is not a function
但其他功能(如toEqual、toBeTruthy)工作正常。
我正在使用 Jest v15.1.1(根据jest -v)。
我该如何处理?
【问题讨论】:
标签: javascript jestjs