question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Test on multiple React versions

See original GitHub issue

I’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 --prefix config option that we can use to change (I believe) the location where it looks for package.json and node_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:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
cellogcommented, Oct 10, 2018

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

1reaction
timdorrcommented, Oct 10, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found