I've been working on an Angular project with my team, and we ran into a situation where tests were failing for a couple of team members, but working fine for everyone else. It was infuriating. We decided the issue must be with a version mismatch of some library, as opposed to the test itself.
Node libraries, by definition, have a lot of inner dependencies. How do we get a list of all the top level libraries installed on each user's respective machine? It's easy:
npm list -global -depth 0
The npm list command will give you the list. The `-global` flag will tell you to list all node packages installed globally.
The depth will give us the top level package, but none of the internal dependencies.
Run this and I get something like this:
I only have the Angular CLI installed globally.
To get a list of locally installed libraries, you can just drop out the global flag:
npm list -depth 0
If you want see the full list of dependencies, you can leave out the depth argument entirely.
Using this approach, we were able to determine the differences in installed base of the affected users vs the ones who could still run tests. It was a good first step in debugging the issue.