Skip to content

Commit 9f1ff48

Browse files
author
Felix Oghină
committed
Merge pull request facebook#3000 from foghina/fix_yeoman_tests
[cli] use different names in generator tests This should fix facebook#2974
2 parents 51917f6 + 2dcb069 commit 9f1ff48

File tree

3 files changed

+45
-36
lines changed

3 files changed

+45
-36
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ env:
7171
- TEST_TYPE=cli
7272
- TEST_TYPE=build_website
7373
- TEST_TYPE=e2e
74-
allow_failures:
75-
- TEST_TYPE=cli
7674
global:
7775
- secure: "HlmG8M2DmBUSBh6KH1yVIe/8gR4iibg4WfcHq1x/xYQxGbvleq7NOo04V6eFHnl9cvZCu+PKH0841WLnGR7c4BBf47GVu/o16nXzggPumHKy++lDzxFPlJ1faMDfjg/5vjbAxRUe7D3y98hQSeGHH4tedc8LvTaFLVu7iiGqvjU="
7876

local-cli/__tests__/generator-android-test.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,26 @@ jest.autoMockOff();
55
var path = require('path');
66

77
describe('react:android', function () {
8-
var assert = require('yeoman-generator').assert;
8+
var assert;
99

1010
beforeEach(function (done) {
11+
// A deep dependency of yeoman spams console.log with giant json objects.
12+
// yeoman-generator/node_modules/
13+
// download/node_modules/
14+
// caw/node_modules/
15+
// get-proxy/node_modules/
16+
// rc/index.js
17+
var log = console.log;
18+
console.log = function() {};
19+
assert = require('yeoman-generator').assert;
1120
var helpers = require('yeoman-generator').test;
21+
console.log = log;
22+
1223
var generated = false;
1324

1425
runs(function() {
1526
helpers.run(path.resolve(__dirname, '..', 'generator-android'))
16-
.withArguments(['TestApp'])
27+
.withArguments(['TestAppAndroid'])
1728
.withOptions({
1829
'package': 'com.reactnative.test',
1930
})
@@ -67,11 +78,11 @@ describe('react:android', function () {
6778
);
6879
assert.fileContent(
6980
path.join('android', 'app', 'src', 'main', 'java', 'com', 'reactnative', 'test', 'MainActivity.java'),
70-
'mReactRootView.startReactApplication(mReactInstanceManager, "TestApp", null);'
81+
'mReactRootView.startReactApplication(mReactInstanceManager, "TestAppAndroid", null);'
7182
);
7283
assert.fileContent(
7384
path.join('android', 'app', 'src', 'main', 'res', 'values', 'strings.xml'),
74-
'<string name="app_name">TestApp</string>'
85+
'<string name="app_name">TestAppAndroid</string>'
7586
);
7687
});
7788
});

local-cli/__tests__/generator-ios-test.js

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('react:ios', function() {
2424

2525
runs(function() {
2626
helpers.run(path.resolve(__dirname, '../generator-ios'))
27-
.withArguments(['TestApp'])
27+
.withArguments(['TestAppIOS'])
2828
.on('end', function() {
2929
generated = true;
3030
});
@@ -40,58 +40,58 @@ describe('react:ios', function() {
4040
it('creates files', function() {
4141
assert.file([
4242
'ios/main.jsbundle',
43-
'ios/TestApp/AppDelegate.h',
44-
'ios/TestApp/AppDelegate.m',
45-
'ios/TestApp/Base.lproj/LaunchScreen.xib',
46-
'ios/TestApp/Images.xcassets/AppIcon.appiconset/Contents.json',
47-
'ios/TestApp/Info.plist',
48-
'ios/TestApp/main.m',
49-
'ios/TestApp.xcodeproj/project.pbxproj',
50-
'ios/TestApp.xcodeproj/xcshareddata/xcschemes/TestApp.xcscheme',
51-
'ios/TestAppTests/TestAppTests.m',
52-
'ios/TestAppTests/Info.plist'
43+
'ios/TestAppIOS/AppDelegate.h',
44+
'ios/TestAppIOS/AppDelegate.m',
45+
'ios/TestAppIOS/Base.lproj/LaunchScreen.xib',
46+
'ios/TestAppIOS/Images.xcassets/AppIcon.appiconset/Contents.json',
47+
'ios/TestAppIOS/Info.plist',
48+
'ios/TestAppIOS/main.m',
49+
'ios/TestAppIOS.xcodeproj/project.pbxproj',
50+
'ios/TestAppIOS.xcodeproj/xcshareddata/xcschemes/TestAppIOS.xcscheme',
51+
'ios/TestAppIOSTests/TestAppIOSTests.m',
52+
'ios/TestAppIOSTests/Info.plist'
5353
]);
5454
});
5555

5656
it('replaces vars in AppDelegate.m', function() {
57-
var appDelegate = 'ios/TestApp/AppDelegate.m';
57+
var appDelegate = 'ios/TestAppIOS/AppDelegate.m';
5858

59-
assert.fileContent(appDelegate, 'moduleName:@"TestApp"');
59+
assert.fileContent(appDelegate, 'moduleName:@"TestAppIOS"');
6060
assert.noFileContent(appDelegate, 'SampleApp');
6161
});
6262

6363
it('replaces vars in LaunchScreen.xib', function() {
64-
var launchScreen = 'ios/TestApp/Base.lproj/LaunchScreen.xib';
64+
var launchScreen = 'ios/TestAppIOS/Base.lproj/LaunchScreen.xib';
6565

66-
assert.fileContent(launchScreen, 'text="TestApp"');
66+
assert.fileContent(launchScreen, 'text="TestAppIOS"');
6767
assert.noFileContent(launchScreen, 'SampleApp');
6868
});
6969

70-
it('replaces vars in TestAppTests.m', function() {
71-
var tests = 'ios/TestAppTests/TestAppTests.m';
70+
it('replaces vars in TestAppIOSTests.m', function() {
71+
var tests = 'ios/TestAppIOSTests/TestAppIOSTests.m';
7272

73-
assert.fileContent(tests, '@interface TestAppTests : XCTestCase');
74-
assert.fileContent(tests, '@implementation TestAppTests');
73+
assert.fileContent(tests, '@interface TestAppIOSTests : XCTestCase');
74+
assert.fileContent(tests, '@implementation TestAppIOSTests');
7575
assert.noFileContent(tests, 'SampleApp');
7676
});
7777

7878
it('replaces vars in project.pbxproj', function() {
79-
var pbxproj = 'ios/TestApp.xcodeproj/project.pbxproj';
80-
assert.fileContent(pbxproj, '"TestApp"');
81-
assert.fileContent(pbxproj, '"TestAppTests"');
82-
assert.fileContent(pbxproj, 'TestApp.app');
83-
assert.fileContent(pbxproj, 'TestAppTests.xctest');
79+
var pbxproj = 'ios/TestAppIOS.xcodeproj/project.pbxproj';
80+
assert.fileContent(pbxproj, '"TestAppIOS"');
81+
assert.fileContent(pbxproj, '"TestAppIOSTests"');
82+
assert.fileContent(pbxproj, 'TestAppIOS.app');
83+
assert.fileContent(pbxproj, 'TestAppIOSTests.xctest');
8484

8585
assert.noFileContent(pbxproj, 'SampleApp');
8686
});
8787

8888
it('replaces vars in xcscheme', function() {
89-
var xcscheme = 'ios/TestApp.xcodeproj/xcshareddata/xcschemes/TestApp.xcscheme';
90-
assert.fileContent(xcscheme, '"TestApp"');
91-
assert.fileContent(xcscheme, '"TestApp.app"');
92-
assert.fileContent(xcscheme, 'TestApp.xcodeproj');
93-
assert.fileContent(xcscheme, '"TestAppTests.xctest"');
94-
assert.fileContent(xcscheme, '"TestAppTests"');
89+
var xcscheme = 'ios/TestAppIOS.xcodeproj/xcshareddata/xcschemes/TestAppIOS.xcscheme';
90+
assert.fileContent(xcscheme, '"TestAppIOS"');
91+
assert.fileContent(xcscheme, '"TestAppIOS.app"');
92+
assert.fileContent(xcscheme, 'TestAppIOS.xcodeproj');
93+
assert.fileContent(xcscheme, '"TestAppIOSTests.xctest"');
94+
assert.fileContent(xcscheme, '"TestAppIOSTests"');
9595

9696
assert.noFileContent(xcscheme, 'SampleApp');
9797
});

0 commit comments

Comments
 (0)