简体   繁体   中英

Missing module when running Jest tests with Arangodb

I am having issues writing Jest tests with Arangodb. This is the code I am running without including the import statements.

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.

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. (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.

Thanks

It looks like if I were to debug Jest it works, it might have to do with something about request.node.js.

Further testing showed that I was able to start the project fresh and get Jest to work with Arangodb. It might be a case of node_modules having a version conflict somewhere

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM