-
Notifications
You must be signed in to change notification settings - Fork 50.9k
Run DevTools tests against npm releases #19377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| 'use strict'; | ||
|
|
||
| /* eslint-disable no-for-of-loops/no-for-of-loops */ | ||
|
|
||
| const fs = require('fs'); | ||
| const {exec} = require('child-process-promise'); | ||
|
|
||
| // Installs an older version of React DOM into build/node_modules. | ||
| // | ||
| // DevTools uses React Test Renderer for its unit tests. Not React DOM. So | ||
| // by updating React DOM to an older release, it will affect the "backend" (the | ||
| // code that runs in the browser) but not the "frontend" (the code that runs | ||
| // the DevTools React app itself). If we were to use React DOM in the DevTools | ||
| // tests, we'd need to figure out a way to load separate versions for the | ||
| // backend and the front end. | ||
|
|
||
| const version = process.argv[2]; | ||
|
|
||
| async function main() { | ||
| await exec('mkdir build-tmp'); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably have some cleanup for if this script fails midway (it does for me at the moment, and it leaves a build-tmp dir which causes it to fail next run) |
||
| await exec('npm install --prefix ./build-tmp react-dom@' + version); | ||
| const modules = fs.readdirSync('build-tmp/node_modules'); | ||
| for (const dep of modules) { | ||
| if ( | ||
| dep.startsWith('.') || | ||
| // Don't replace React isomorphic package, since the backend may use | ||
| // component types/features that don't exist in an older version | ||
| dep === 'react' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will we hit any snags with earlier 16.x react-dom versions and later 16.x react versions? |
||
| ) { | ||
| continue; | ||
| } | ||
| await exec(`rm -rf build/node_modules/${dep}`); | ||
| await exec( | ||
| `cp -r build-tmp/node_modules/${dep} ` + `build/node_modules/${dep}` | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| main(); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yarn_test_release_devtools:
docker: *docker
environment: *environment
parameters:
version:
type: string
default: next
steps:
- checkout
- attach_workspace: *attach_workspace
- *restore_yarn_cache
- *run_yarn
- run:
name: Download a specific version of React + renderers
command: node scripts/jest/install-devtools-release-test-deps.js << parameters.version >>
- run: yarn test --project=devtools --build --ci