Skip to content

Commit

Permalink
Merge pull request #2 from facebook/master
Browse files Browse the repository at this point in the history
update master
  • Loading branch information
Titozzz authored Mar 8, 2018
2 parents f734357 + 4895c64 commit 993beb7
Show file tree
Hide file tree
Showing 143 changed files with 1,845 additions and 1,495 deletions.
87 changes: 18 additions & 69 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,27 +211,27 @@ aliases:
mkdir -p ~/react-native/reports/junit/
- &build-objc-ios-test-app
name: Build Objective-C iOS Test App
name: Build iOS Test App
command: ./scripts/objc-test-ios.sh

- &run-objc-ios-tests
name: Objective-C iOS Test Suite
name: iOS Test Suite
command: ./scripts/objc-test-ios.sh test

- &build-objc-tvos-test-app
name: Build Objective-C tvOS Test App
name: Build tvOS Test App
command: ./scripts/objc-test-tvos.sh

- &run-objc-tvos-tests
name: Objective-C tvOS Test Suite
name: tvOS Test Suite
command: ./scripts/objc-test-tvos.sh test

- &run-objc-ios-e2e-tests
name: Objective-C iOS End-to-End Test Suite
name: iOS End-to-End Test Suite
command: node ./scripts/run-ci-e2e-tests.js --ios --js --retries 3;

- &run-objc-tvos-e2e-tests
name: Objective-C tvOS End-to-End Test Suite
name: tvOS End-to-End Test Suite
command: node ./scripts/run-ci-e2e-tests.js --tvos --js --retries 3;

defaults: &defaults
Expand Down Expand Up @@ -292,8 +292,6 @@ jobs:

- store_test_results:
path: ~/react-native/reports/junit
- store_artifacts:
path: ~/react-native/reports/junit
- store_artifacts:
path: ~/react-native/yarn.lock

Expand All @@ -308,8 +306,6 @@ jobs:

- store_test_results:
path: ~/react-native/reports/junit
- store_artifacts:
path: ~/react-native/reports/junit

# Runs JavaScript tests on Node 6
test_javascript_node6_compatibility:
Expand All @@ -328,83 +324,47 @@ jobs:

- store_test_results:
path: ~/react-native/reports/junit
- store_artifacts:
path: ~/react-native/reports/junit

# Builds iOS test app
build_objc_ios_test_app:
<<: *macos_defaults
dependencies:
pre:
- xcrun instruments -w "iPhone 5s (11.1)" || true
steps:
- attach_workspace:
at: ~/react-native

- run: *build-objc-ios-test-app

# Runs unit tests on iOS devices
test_objc_ios:
test_ios:
<<: *macos_defaults
dependencies:
pre:
- xcrun instruments -w "iPhone 5s (11.1)" || true
steps:
- attach_workspace:
at: ~/react-native

- run: xcrun instruments -w "iPhone 5s (11.1)" || true
- run: brew install watchman
- run: *run-objc-ios-tests

- store_test_results:
path: ~/react-native/reports/junit
- store_artifacts:
path: ~/react-native/reports/junit

# Builds tvOS test app
build_objc_tvos_test_app:
<<: *macos_defaults
dependencies:
pre:
- xcrun instruments -w "Apple TV 1080p (11.1)" || true
steps:
- attach_workspace:
at: ~/react-native

- run: *build-objc-tvos-test-app

# Runs unit tests on tvOS devices
test_objc_tvos:
test_tvos:
<<: *macos_defaults
dependencies:
pre:
- xcrun instruments -w "Apple TV 1080p (11.1)" || true
steps:
- attach_workspace:
at: ~/react-native

- run: xcrun instruments -w "Apple TV 1080p (11.1)" || true
- run: brew install watchman
- run: *run-objc-tvos-tests

- store_test_results:
path: ~/react-native/reports/junit
- store_artifacts:
path: ~/react-native/reports/junit

# Runs end to end tests
test_objc_ios_e2e:
test_ios_e2e:
<<: *macos_defaults
dependencies:
pre:
- xcrun instruments -w "iPhone 5s (11.1)" || true
steps:
- attach_workspace:
at: ~/react-native

- run: xcrun instruments -w "iPhone 5s (11.1)" || true
- run: *run-objc-ios-e2e-tests

- store_test_results:
path: ~/react-native/reports/junit
- store_artifacts:
path: ~/react-native/reports/junit

# Checks podspec
test_podspec:
Expand Down Expand Up @@ -523,8 +483,6 @@ jobs:
- run: *collect-android-test-results
- store_test_results:
path: ~/react-native/reports/junit
- store_artifacts:
path: ~/react-native/reports/junit


# Analyze pull request and raise any lint/flow issues.
Expand Down Expand Up @@ -604,18 +562,18 @@ workflows:
requires:
- checkout_code

# Build iOS & tvOS test apps
- build_objc_ios_test_app:
# Test iOS & tvOS
- test_ios:
filters: *filter-ignore-gh-pages
requires:
- checkout_code
- build_objc_tvos_test_app:
- test_tvos:
filters: *filter-ignore-gh-pages
requires:
- checkout_code

# End-to-end tests
- test_objc_ios_e2e:
- test_ios_e2e:
filters: *filter-ignore-gh-pages
requires:
- checkout_code
Expand Down Expand Up @@ -657,15 +615,6 @@ workflows:

# # The following were DISABLED because they have not run since
# # the migration from Travis, and they have broken since then,
# # Test iOS & tvOS
# - test_objc_ios:
# filters: *filter-ignore-gh-pages
# requires:
# - checkout_code
# - test_objc_tvos:
# filters: *filter-ignore-gh-pages
# requires:
# - checkout_code
# # CocoaPods
# - test_podspec:
# filters: *filter-ignore-gh-pages
Expand Down
6 changes: 6 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"flowtype",
"prettier",
"react",
"react-native",
"jest"
],

Expand Down Expand Up @@ -252,6 +253,11 @@
"react/self-closing-comp": 1,
"react/wrap-multilines": 0,

// React-Native Plugin
// The following rules are made available via `eslint-plugin-react-native`

"react-native/no-inline-styles": 1,

// Jest Plugin
// The following rules are made available via `eslint-plugin-jest`.
"jest/no-disabled-tests": 1,
Expand Down
8 changes: 4 additions & 4 deletions Libraries/Animated/src/nodes/AnimatedTransform.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ const AnimatedWithChildren = require('./AnimatedWithChildren');
const NativeAnimatedHelper = require('../NativeAnimatedHelper');

class AnimatedTransform extends AnimatedWithChildren {
_transforms: Array<Object>;
_transforms: $ReadOnlyArray<Object>;

constructor(transforms: Array<Object>) {
constructor(transforms: $ReadOnlyArray<Object>) {
super();
this._transforms = transforms;
}
Expand All @@ -34,7 +34,7 @@ class AnimatedTransform extends AnimatedWithChildren {
});
}

__getValue(): Array<Object> {
__getValue(): $ReadOnlyArray<Object> {
return this._transforms.map(transform => {
const result = {};
for (const key in transform) {
Expand All @@ -49,7 +49,7 @@ class AnimatedTransform extends AnimatedWithChildren {
});
}

__getAnimatedValue(): Array<Object> {
__getAnimatedValue(): $ReadOnlyArray<Object> {
return this._transforms.map(transform => {
const result = {};
for (const key in transform) {
Expand Down
31 changes: 31 additions & 0 deletions Libraries/Blob/__tests__/File-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,39 @@ jest.setMock('NativeModules', {
BlobModule: require('../__mocks__/BlobModule'),
});

const Blob = require('Blob');
const File = require('File');

describe('babel 7 smoke test', function() {
it('should be able to extend a class with native name', function() {
let called = false;
class Array {
constructor() {
called = true;
return {foo: 'PASS'};
}
}
class A extends Array {
constructor() {
super();
}
}

// there is/was a regression in Babel where this would break and super()
// would not actually invoke the constructor of the parent class if the
// parent class had a name matching a built-in class (like Blob)
expect(new A().foo).toBe('PASS');
expect(called).toBe(true);
});
});

describe('Blob', function() {
it('regression caused by circular dep && babel 7', function() {
const blob = new Blob([], {type: 'image/jpeg'});
expect(blob).toBeInstanceOf(Blob);
});
});

describe('File', function() {
it('should create empty file', () => {
const file = new File([], 'test.jpg');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
*/
'use strict';

var NativeModules = require('NativeModules');
var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
const NativeModules = require('NativeModules');
const RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');

var RCTAccessibilityInfo = NativeModules.AccessibilityInfo;
const RCTAccessibilityInfo = NativeModules.AccessibilityInfo;

var TOUCH_EXPLORATION_EVENT = 'touchExplorationDidChange';
const TOUCH_EXPLORATION_EVENT = 'touchExplorationDidChange';

type ChangeEventName = $Enum<{
change: string,
}>;

var _subscriptions = new Map();
const _subscriptions = new Map();

/**
* Sometimes it's useful to know whether or not the device has a screen reader
Expand All @@ -32,7 +32,7 @@ var _subscriptions = new Map();
* See http://facebook.github.io/react-native/docs/accessibilityinfo.html
*/

var AccessibilityInfo = {
const AccessibilityInfo = {

fetch: function(): Promise {
return new Promise((resolve, reject) => {
Expand All @@ -48,7 +48,7 @@ var AccessibilityInfo = {
eventName: ChangeEventName,
handler: Function
): void {
var listener = RCTDeviceEventEmitter.addListener(
const listener = RCTDeviceEventEmitter.addListener(
TOUCH_EXPLORATION_EVENT,
(enabled) => {
handler(enabled);
Expand All @@ -61,7 +61,7 @@ var AccessibilityInfo = {
eventName: ChangeEventName,
handler: Function
): void {
var listener = _subscriptions.get(handler);
const listener = _subscriptions.get(handler);
if (!listener) {
return;
}
Expand Down
20 changes: 10 additions & 10 deletions Libraries/Components/AccessibilityInfo/AccessibilityInfo.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
*/
'use strict';

var NativeModules = require('NativeModules');
var Promise = require('Promise');
var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
const NativeModules = require('NativeModules');
const Promise = require('Promise');
const RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');

var AccessibilityManager = NativeModules.AccessibilityManager;
const AccessibilityManager = NativeModules.AccessibilityManager;

var VOICE_OVER_EVENT = 'voiceOverDidChange';
var ANNOUNCEMENT_DID_FINISH_EVENT = 'announcementDidFinish';
const VOICE_OVER_EVENT = 'voiceOverDidChange';
const ANNOUNCEMENT_DID_FINISH_EVENT = 'announcementDidFinish';

type ChangeEventName = $Enum<{
change: string,
announcementFinished: string
}>;

var _subscriptions = new Map();
const _subscriptions = new Map();

/**
* Sometimes it's useful to know whether or not the device has a screen reader
Expand All @@ -34,7 +34,7 @@ var _subscriptions = new Map();
*
* See http://facebook.github.io/react-native/docs/accessibilityinfo.html
*/
var AccessibilityInfo = {
const AccessibilityInfo = {

/**
* Query whether a screen reader is currently enabled.
Expand Down Expand Up @@ -72,7 +72,7 @@ var AccessibilityInfo = {
eventName: ChangeEventName,
handler: Function
): Object {
var listener;
let listener;

if (eventName === 'change') {
listener = RCTDeviceEventEmitter.addListener(
Expand Down Expand Up @@ -127,7 +127,7 @@ var AccessibilityInfo = {
eventName: ChangeEventName,
handler: Function
): void {
var listener = _subscriptions.get(handler);
const listener = _subscriptions.get(handler);
if (!listener) {
return;
}
Expand Down
Loading

0 comments on commit 993beb7

Please sign in to comment.