Missing module when running Jest tests with Arangodb

272 Views Asked by At

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

1

There are 1 best solutions below

0
On

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