mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
In DevTools tests, if the REACT_VERSION specified, we know this is a regression test (testing older React Versions). Because a lot of tests test the DevTools front end and we don't want to run them in the regression test scenario, we decided to only run tests that have the // @reactVersion pragma defined. Because if there are no tests specified, jest will fail, we also opt to use jest.skip to skip all the tests that we don't want to run for a specific React version istead. This PR makes this change.
21 lines
415 B
JavaScript
21 lines
415 B
JavaScript
'use strict';
|
|
|
|
const pathToTransformReactVersionPragma = require.resolve(
|
|
'../../babel/transform-react-version-pragma'
|
|
);
|
|
|
|
function getDevToolsPlugins(filePath) {
|
|
const plugins = [];
|
|
if (
|
|
process.env.REACT_VERSION ||
|
|
filePath.match(/\/transform-react-version-pragma-test/)
|
|
) {
|
|
plugins.push(pathToTransformReactVersionPragma);
|
|
}
|
|
return plugins;
|
|
}
|
|
|
|
module.exports = {
|
|
getDevToolsPlugins,
|
|
};
|