In this lab, we're going to explore how to resolve dependency issues in Node.js. We've provided a bare-bones project in lib/ — it currently fails all its tests. Your job is to make sure the tests pass.
npm test — you'll notice that everything crashes. Like before, we'll need to install a few packages just to get tests to run. But even with those packages installed, things won't run quite as expected.
Before we set you loose, there's one last thing we need to introduce (and we promise not to make the whole introduction in rhyming couplets).
npm has a concept of
peerDependencies that's important to understand.
peerDependencies (which can be declared in a
package.json just like
devDependencies) describe packages that require a "host" package — you can think of
peerDependencies as plugins. One example of a host package that we've already encountered is Chai.js. Each Chai plugin has
chai as a
peerDependency, meaning that the plugin expects that it will be required in an environment that also has
NOTE: There will be a warning that a peerDependency hasn't been met no matter what. It's currently an open issue on npm: https://github.com/npm/npm/issues/3218. The trick is still to make sure to get the right version of the peerDependency from the repository that we've provided. (Remember that you can refer to specific commits.)