From 75ecaf4190dc4d30e4031f3572f9b1d9aa834179 Mon Sep 17 00:00:00 2001 From: Christoph Pojer Date: Wed, 27 Jul 2016 22:02:42 -0700 Subject: [PATCH] Update to 14.0 Reviewed By: kassens Differential Revision: D3627753 fbshipit-source-id: 35b8246c8cb61e60908d8c233a6e72063bf67096 --- .../Touchable/__mocks__/ensureComponentIsNative.js | 11 +++++++++++ .../Touchable/__tests__/TouchableHighlight-test.js | 5 ----- .../__snapshots__/TouchableHighlight-test.js.snap | 6 ++++-- Libraries/Text/__mocks__/Text.js | 3 +++ jestSupport/env.js | 14 ++++++++++++++ package.json | 10 ++++++---- .../src/Bundler/__tests__/Bundler-test.js | 4 ++-- 7 files changed, 40 insertions(+), 13 deletions(-) create mode 100644 Libraries/Components/Touchable/__mocks__/ensureComponentIsNative.js diff --git a/Libraries/Components/Touchable/__mocks__/ensureComponentIsNative.js b/Libraries/Components/Touchable/__mocks__/ensureComponentIsNative.js new file mode 100644 index 000000000..e537f2be0 --- /dev/null +++ b/Libraries/Components/Touchable/__mocks__/ensureComponentIsNative.js @@ -0,0 +1,11 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ +'use strict'; + +module.exports = () => true; diff --git a/Libraries/Components/Touchable/__tests__/TouchableHighlight-test.js b/Libraries/Components/Touchable/__tests__/TouchableHighlight-test.js index 597484c4f..5a46044e4 100644 --- a/Libraries/Components/Touchable/__tests__/TouchableHighlight-test.js +++ b/Libraries/Components/Touchable/__tests__/TouchableHighlight-test.js @@ -9,11 +9,6 @@ jest.disableAutomock(); -jest.mock('NativeModules') - .mock('Text') - .mock('ensureComponentIsNative') - .mock('View'); - const React = require('React'); const ReactTestRenderer = require('react/lib/ReactTestRenderer'); const Text = require('Text'); diff --git a/Libraries/Components/Touchable/__tests__/__snapshots__/TouchableHighlight-test.js.snap b/Libraries/Components/Touchable/__tests__/__snapshots__/TouchableHighlight-test.js.snap index 09fc682ea..eb6648902 100644 --- a/Libraries/Components/Touchable/__tests__/__snapshots__/TouchableHighlight-test.js.snap +++ b/Libraries/Components/Touchable/__tests__/__snapshots__/TouchableHighlight-test.js.snap @@ -1,4 +1,4 @@ -exports[`TouchableHighlight renders correctly 0`] = ` +exports[`TouchableHighlight renders correctly 1`] = ` ({ + register: id => id, + getByID: () => mockEmptyObject, +})); + jest.setMock('ErrorUtils', require('ErrorUtils')); diff --git a/package.json b/package.json index b34eda1f7..85ea4ed7c 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "defaultPlatform": "ios", "providesModuleNodeModules": [ "react-native", + "react", "parse" ], "platforms": [ @@ -33,6 +34,7 @@ ] }, "modulePathIgnorePatterns": [ + "Libraries/react-native/", "/node_modules/(?!react|fbjs|react-native|parse|react-transform-hmr|core-js|promise)/", "node_modules/react/node_modules/fbjs/", "node_modules/react/lib/ReactDOM.js", @@ -113,7 +115,7 @@ "flow" ], "scripts": { - "test": "NODE_ENV=test jest", + "test": "jest", "flow": "flow", "lint": "eslint Examples/ Libraries/", "start": "/usr/bin/env bash -c './packager/packager.sh \"$@\" || true' --" @@ -199,9 +201,9 @@ "eslint-plugin-flow-vars": "^0.2.1", "eslint-plugin-react": "^4.2.1", "flow-bin": "^0.29.0", - "jest": "^13.1.0", - "jest-repl": "^13.1.0", - "jest-runtime": "^13.1.0", + "jest": "latest", + "jest-repl": "latest", + "jest-runtime": "latest", "portfinder": "0.4.0", "react": "~15.3.0-rc.2", "shelljs": "0.6.0" diff --git a/packager/react-packager/src/Bundler/__tests__/Bundler-test.js b/packager/react-packager/src/Bundler/__tests__/Bundler-test.js index 33cca0548..eef2dab56 100644 --- a/packager/react-packager/src/Bundler/__tests__/Bundler-test.js +++ b/packager/react-packager/src/Bundler/__tests__/Bundler-test.js @@ -174,7 +174,7 @@ describe('Bundler', function() { {runMainModule: true, runBeforeMainModule: []} ]); - expect(bundle.addAsset.mock.calls).toContain([{ + expect(bundle.addAsset.mock.calls[0]).toEqual([{ __packager_asset: true, path: '/root/img/img.png', uri: 'img', @@ -183,7 +183,7 @@ describe('Bundler', function() { deprecated: true, }]); - expect(bundle.addAsset.mock.calls).toContain([{ + expect(bundle.addAsset.mock.calls[1]).toEqual([{ __packager_asset: true, fileSystemLocation: '/root/img', httpServerLocation: '/assets/img',