how to use with multiple versions ?
Following install multiple versions
I have
"dependencies": {
"es6": "npm:@elastic/elasticsearch@^6.7.0",
"es7": "npm:@elastic/elasticsearch@^7.0.0"
}
in my package.json
However when adding elasticsearch-mock, it uses require('@elastic/elasticsearch') for { Connection, errors } (without a peer dependency too ...)
How can I use the client I want with mock ?
Hello! I think the only solution is to write an "hack" with proxyquire.
Thanks for the answer, I've been using http-proxy for mocking only parts of elasticsearch (to simulate errors), with an actual elasticsearch as fallback. It works quite well and does not require mingling with the client lib, just pass the http-proxy url to the client and you're good to go :) (not using elasticsearch-js-mock at all)