[英]Missing module when running Jest tests with Arangodb
I am having issues writing Jest tests with Arangodb. 我在用Arangodb编写Jest测试时遇到问题。 This is the code I am running without including the import statements. 这是我运行的代码,没有包含import语句。
describe('Word store', () => {
it('should return an object', () => {
// Arrange
const dataSource = new Database(uri);
dataSource.useBasicAuth(user, password);
dataSource.useDatabase(database);
// Act
const store = new Store(dataSource);
// Assert
expect(store).toMatchObject({
get: expect.any(Function)
});
});
});
When executing the Jest tests, I get the following error message I have tried doing npm install --save request or npm install --save linkedlist. 当执行Jest测试时,我收到以下错误消息,我尝试执行npm install --save请求或npm install --save链表。
Test suite failed to run Cannot find module 'linkedlist' from 'request.node.js' at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:191:17) at Object. 测试套件无法运行在Object的Resolver.resolveModule(node_modules / jest-resolve / build / index.js:191:17)的“ request.node.js”中找不到模块“链表”。 (node_modules/arangojs/lib/util/request.node.js:92:19) (node_modules / arangojs / lib / util / request.node.js:92:19)
It will be great if anyone might be able to offer some advice about writing Jest with ArangoDB correctly. 如果有人能够提供一些有关正确使用ArangoDB编写Jest的建议,那将是很棒的。
Thanks 谢谢
It looks like if I were to debug Jest it works, it might have to do with something about request.node.js. 看来,如果我要调试Jest,它可能会起作用,这可能与request.node.js有关。
Further testing showed that I was able to start the project fresh and get Jest to work with Arangodb. 进一步的测试表明,我能够重新启动该项目,并使Jest与Arangodb一起工作。 It might be a case of node_modules having a version conflict somewhere 可能是node_modules在某处存在版本冲突的情况
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.