Test on multiple React versions
See original GitHub issueI’d like to run our tests on multiple versions of React in CI, if we can.
- Travis supports build matrices which we can use to run multiple jobs with different environment variables, so that should help.
- npm supports a
--prefixconfig option that we can use to change (I believe) the location where it looks forpackage.jsonandnode_modules.
So we may be able to use these 2 features in combination to do something like this in our Travis config:
env:
- NPM_PREFIX=react-15
- NPM_PREFIX=react-16
install:
- npm install --prefix=$NPM_PREFIX
It seems a little hacky, and there would probably be some bugs to work out. But it might work.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Two Ways to Run Tests on Different Versions of The Same ...
We run the tests from a folder with its own node_modules where React 16 is installed.
Read more >Test on multiple React versions · Issue #6388 - GitHub
I'd like to run our tests on multiple versions of React in CI, if we can. Travis supports build matrices which we can...
Read more >Solve having more than one copy of React in the same app
In the module you are developing, add the conflicting packages to peerDependencies (and remove them from dependencies or devDependencies ):
Read more >Testing with multiple versions of npm packages - Thibaud's blog
Have you ever wondered how to test your library against multiple versions of a project like React? Well, there is a way –...
Read more >How to Check React Version? [React Latest Version] - MonoVM
Method 2: Another simple method to check React latest version is by navigating to the node_modules/react/cjs/react.development.js You can check ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Quick chime in: this was the only way I found to do it that didn’t have the npm equivalent of dll hell. If the way you implement it is similar, let me know, I would be willing to abstract that into an external package for testing against multiple versions of external deps
We’ve got this set up on React Redux if you want to steal some ideas: https://github.com/reduxjs/react-redux/tree/master/test @cellog set it up for us.