TypeError: Cannot destructure property 'ConfigurationError' of 'errors' as it is undefined.
Hi folks, I'm trying to use this library but I'm seeing the following error. Am I doing something wrong?
TypeError: Cannot destructure property 'ConfigurationError' of 'errors' as it is undefined.

Some additional info: "@elastic/elasticsearch-mock": "^0.3.0" "@elastic/elasticsearch": "^7.8.1"
Hello! I just tried to reproduce this issue by using the example in the README and the latest version of both libraries and I didn't see any issue. Is this still happening to you?
I just experienced this. It seems specifically typescript related. If I run the example.js file locally, it runs perfectly fine. If I try to
import Mock from '@elastic/elasticsearch-mock';
in any typescript file, I get the above error. I'm using "typescript": "^4.1.3"
I also get the same error when using typescript
I am experiencing the same issue. Someone has some update?
You can reproduce the error if you create the mock with this dir structure
__mocks__ |_@elastic |_elasticsearch.ts
import Client from '@elastic/elasticsearch';
import Mock from '@elastic/elasticsearch-mock';
const mock = new Mock()
const client = new Client({
node: 'http://localhost:9200',
Connection: mock.getConnection()
})
mock.add({
method: 'GET',
path: '/_cat/health'
}, () => {
return { status: 'ok' }
})
client.cat.health(console.log)
I've had this issue to and ended up solving by mocking it like this:
jest.mock('./client', () => ({
getClient: () => mockedClient,
}))