I am new to understand peerDependencies, and I have read the following references seeking as to how to test an npm module contains peerDependencies within its package.json:
- Peer Dependencies
- Understanding the npm dependency model
- Common npm mistakes
- StackOverflow: npm peerDependencies during development
However, I have not found a clear solution for testing npm with peerDependencies. Some recommend adding the peerDependencies as globals, and some reference to include peerDependencies within devDependencies, and neither seems right.
For example, I have a package that has a peer dependency, a custom logger, and this logger needs to be configured by its host package before it can be used.
This is how I perform most tests scripted in using this Gulp task:
function testRunner() {
return (
gulp
.src('./tests/**/*.js', { read: false })
.pipe(
mocha({
exit: true,
timeout: 10000
})
)
.on('error', console.error)
);
}
I did receive a helpful suggestion (see comments below, @estus) to use npm-install-peers, however, I am not yet certain if it can configure a peer dependency before usage, as it would be performed by the host package.
Feedback and Suggestions are most appreciated.
"dep-v1": "npm:dep@1", "dep": "2"
in yourdevDependencies
– Adahadaha