Testing and documentation for changes
Testing
The various things to consider for testing the project for changes are:
- Backup: You must always create a complete project backup before overriding dependencies. This allows you to revert if necessary.
- Testing of specific dependency: Check the part of project that uses on the overridden dependencies.
- Version Checks: Make sure that the overridden versions are compatible with other project dependencies and your overall application requirements.
- Test in Different Environments: In Different environments such development or production, your project must be tested to catch any environment-specific issues.
Documentation
The various things to consider for documentation of the changes to the project and dependencies are:
- Document the Dependencies: Clearly document the overridden versions of nested dependencies and the reasoning behind it.
- Update every Information: Every time the package.json gets updated document the whole file by copying or copying only the specific changes.
- Document Testing Results: Record the results of your tests which can be any issues encountered after overriding dependencies or the project behaviours after the overrides.
How to override nested NPM dependency versions?
In projects the packages download and used using npm are called dependency and each dependencies can have their own nested dependencies that also gets downloaded. These nested dependency creates conflicts due to the presence of multiple version of the same dependency. This will lead to issues like compatibility, security vulnerabilities, and unexpected behavior.
To solve that we got multiple ways such as overrides property in package.json file, npm-force-resolutions, npm dedupe, npm-check-updates or yarn-upgrade-all.
Table of Content
- Manual override in package.json
- Utilizing npm’s npm-force-resolutions
- Using npm dedupe(deduplicate)
- Automation with npm-check-updates or yarn-upgrade-all
- npm users
- yarn users
- Testing and documentation for changes
- Best practices for management