-
Notifications
You must be signed in to change notification settings - Fork 21
React test suite addition attempt 2 #18
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
Changes from 2 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,12 @@ | ||
| const { clone } = require('./utils'); | ||
|
|
||
| const repoURL = 'git@github.com:facebook/react.git'; | ||
| const clonePath = './test/react-test-suite'; | ||
| console.log('Cloning...'); | ||
| clone(repoURL, clonePath) | ||
| .then(() => { | ||
| console.log('cloned'); | ||
| }) | ||
| .catch(e => { | ||
| console.log('Cloning failed'); | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| const { exec } = require('child_process'); | ||
| const { transform } = require('babel-core'); | ||
|
|
||
| module.exports.clone = function(url, dirname) { | ||
| return new Promise((resolve, reject) => { | ||
| exec(`git clone --depth 1 ${url} ${dirname}`, error => { | ||
|
Owner
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. i'd use the
Collaborator
Author
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. I usually avoid third party if requirments are trivial :)
Owner
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. Why maintain the code tho? That's the advantage to the big ecosystem :)
Collaborator
Author
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. True :) |
||
| if (error) { | ||
| reject(error); | ||
| } else { | ||
| resolve(error); | ||
| } | ||
| }); | ||
| }); | ||
| }; | ||
|
|
||
| module.exports.silenceTests = filter => { | ||
| babel; | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| // const packageJSON = require('../../package.json'); | ||
| // module.exports = Object.assign( | ||
| // {}, | ||
| // // packageJSON.jest, | ||
| // { | ||
| // transform:{ | ||
| // '.*': require.resolve('./preprocess.react-test-suite.js') | ||
| // }, | ||
| // setupFiles: ['./test/setup.js'], | ||
| // moduleNameMapper: { | ||
| // 'react-dom': '<rootDir>/lib/index.js', | ||
| // }, | ||
| // testRegex: | ||
| // 'test/react-test-suite/packages/react-dom/src/__tests__/.*\\.js$', | ||
| // rootDir: process.cwd(), | ||
| // roots: ['<rootDir>/test/react-test-suite/packages'], | ||
| // }, | ||
| // ); | ||
|
|
||
| const reactJestSourceConfig = require('../../test/react-test-suite/scripts/jest/config.source.js'); | ||
|
|
||
| module.exports = Object.assign({}, reactJestSourceConfig, { | ||
| modulePathIgnorePatterns: [ | ||
| '<rootDir>/test/react-test-suite/scripts/rollup/shims/', | ||
| '<rootDir>/test/react-test-suite/scripts/bench/', | ||
| ], | ||
| moduleNameMapper: { | ||
| 'react-dom': '<rootDir>/lib/index.js', | ||
| }, | ||
| testRegex: '/react-dom/src/__tests__/[^/]*(\\.js)$', | ||
| roots: ['<rootDir>/test/react-test-suite/packages'], | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| const babel = require('babel-core'); | ||
| const path = require('path'); | ||
|
|
||
| const babelOptions = { | ||
|
Owner
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. i don't think you need a custom transformer here, the root babelrc will be picked up and will work. as it is jest is only running the files in
Collaborator
Author
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. Actually there's no filter. L16 is just left over code. I'll remove it. |
||
| plugins: [ | ||
| // For Node environment only. For builds, Rollup takes care of ESM. | ||
| require.resolve('babel-plugin-transform-es2015-modules-commonjs'), | ||
| require.resolve('babel-plugin-transform-react-jsx-source'), | ||
| require.resolve('babel-plugin-transform-async-to-generator'), | ||
| ], | ||
| retainLines: true, | ||
| }; | ||
|
|
||
| module.exports = { | ||
| process: function(src, filePath) { | ||
| const isTestFile = !!filePath.match(/\/__tests__\//); | ||
| return babel.transform( | ||
| src, | ||
| Object.assign( | ||
| { filename: path.relative(process.cwd(), filePath) }, | ||
| babelOptions, | ||
| ), | ||
| ).code; | ||
| }, | ||
| }; | ||
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.
I'd clone based on tag as well maybe. I don't know that we want to be testing against a master all the time, better to test against the tests for a specific version e.g. 16.2.0
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.
I'm worried it'll slow down the cloning. Just clarifying, whats does the workflow look like again. How often will we be running this script?
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.
I'd think wed only run it in CI or as one offs probably. I don't think cloning by tag would affect the speed tho (could be wrong tho)
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.
Clone just the latest tag?