mirror of
https://github.com/status-im/react-native.git
synced 2025-02-21 21:58:18 +00:00
Fix tests in template project (0.58-stable) (#23128)
* Restore __tests__ folder in HelloWorld template PR #18019 Removed __tests__ and __fixtures__ folders from npm package. But it also effectively removed __tests__ folder from initial project template. This commit restores __tests__ in template application. It applicable only to 0.58-stable branch because in master, templates was moved to another location. I think we should recheck what is ignored in master after this landed. * Use babel.config.js in template HelloWorld application * Add babel-core@^7.0.0-bridge.0 to jest dependencies when react-native init new project. This should fix tests with babel7.
This commit is contained in:
parent
26793a052a
commit
23cfa29ac7
@ -1,2 +1,3 @@
|
||||
__fixtures__
|
||||
__tests__
|
||||
!/templates/HelloWorld/__tests__
|
||||
|
@ -127,6 +127,7 @@ function translateFilePath(path) {
|
||||
.replace('_BUCK', 'BUCK')
|
||||
.replace('_gitignore', '.gitignore')
|
||||
.replace('_gitattributes', '.gitattributes')
|
||||
.replace('_babel.config.js', 'babel.config.js')
|
||||
.replace('_babelrc', '.babelrc')
|
||||
.replace('_flowconfig', '.flowconfig')
|
||||
.replace('_buckconfig', '.buckconfig')
|
||||
|
@ -90,7 +90,7 @@ function generateProject(destinationRoot, newProjectName, options) {
|
||||
});
|
||||
}
|
||||
if (!options['skip-jest']) {
|
||||
const jestDeps = `jest babel-jest metro-react-native-babel-preset react-test-renderer@${reactVersion}`;
|
||||
const jestDeps = `jest babel-core@^7.0.0-bridge.0 babel-jest metro-react-native-babel-preset react-test-renderer@${reactVersion}`;
|
||||
if (yarnVersion) {
|
||||
console.log('Adding Jest...');
|
||||
execSync(`yarn add ${jestDeps} --dev --exact`, {stdio: 'inherit'});
|
||||
|
3
local-cli/templates/HelloWorld/_babel.config.js
Normal file
3
local-cli/templates/HelloWorld/_babel.config.js
Normal file
@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
presets: ["module:metro-react-native-babel-preset"]
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"presets": ["module:metro-react-native-babel-preset"]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user