node.jstypescriptkafkajs

How can I access kafkajs' testHelpers module for my own tests?


I would like to write unit/integration tests for code in my Typescript project that uses the kafkajs NPM package. The project recommends the testHelpers module that is used in its own unit tests. However, this module doesn't appear to be included in the package. What's the correct way to depend upon and access the testHelpers module in my own code?

I'm installing the package by adding "kafkajs": "^2.2.4" to the dependencies field (and have tried adding to/only to devDependencies too) in my package.json file.

By examining node_modules/kafkajs I can see that the testHelpers folder doesn't exist.


Solution

  • From Estus Flask's comment above

    The docs most likely refer to package's own tests, the helpers may not be useful for yours. Anything test-related isn't leaked to npm by intention, npmignore applies there. In case you believe they are useful, you'll have to copy testHelpers manually or clone the whole repo to your project