diff --git a/.travis.yml b/.travis.yml index 79e95cb4e18541..c88201e9037d77 100644 --- a/.travis.yml +++ b/.travis.yml @@ -212,6 +212,3 @@ jobs: local_dir: playground/dist on: branch: master - - allow_failures: - - name: JavaScript native mobile tests diff --git a/packages/react-native-editor/jest.config.js b/packages/react-native-editor/jest.config.js deleted file mode 100644 index 4cc35422c25ced..00000000000000 --- a/packages/react-native-editor/jest.config.js +++ /dev/null @@ -1,60 +0,0 @@ -/** @flow - * @format */ - -const defaultPlatform = 'android'; -const rnPlatform = process.env.TEST_RN_PLATFORM || defaultPlatform; -if ( process.env.TEST_RN_PLATFORM ) { - // eslint-disable-next-line no-console - console.log( 'Setting RN platform to: ' + process.env.TEST_RN_PLATFORM ); -} else { - // eslint-disable-next-line no-console - console.log( 'Setting RN platform to: default (' + defaultPlatform + ')' ); -} - -module.exports = { - verbose: true, - // Automatically clear mock calls and instances between every test - clearMocks: true, - preset: 'react-native', - setupFiles: [ - '/gutenberg/test/native/setup.js', - '/gutenberg/test/native/enzyme.config.js', - ], - testEnvironment: 'jsdom', - testMatch: [ - '**/test/*.native.[jt]s?(x)', - '/src/**/__tests__/**/*.[jt]s?(x)', - '/src/**/?(*.)+(spec|test).[jt]s?(x)', - ], - testPathIgnorePatterns: [ - '/node_modules/', - '/gutenberg/gutenberg-mobile/', - '/gutenberg/test/', - '/__device-tests__/', - ], - testURL: 'http://localhost/', - modulePathIgnorePatterns: [ - '/gutenberg/gutenberg-mobile', - 'react-native-aztec-old-submodule', - ], - moduleDirectories: [ 'node_modules', 'symlinked-packages' ], - moduleNameMapper: { - // Mock the CSS modules. See https://facebook.github.io/jest/docs/en/webpack.html#handling-static-assets - '\\.(scss)$': '/gutenberg/test/native/__mocks__/styleMock.js', - }, - haste: { - defaultPlatform: rnPlatform, - platforms: [ 'android', 'ios', 'native' ], - hasteImplModulePath: '/node_modules/react-native/jest/hasteImpl.js', - providesModuleNodeModules: [ 'react-native', 'react-native-svg' ], - }, - transformIgnorePatterns: [ - // This is required for now to have jest transform some of our modules - // See: https://github.com/wordpress-mobile/gutenberg-mobile/pull/257#discussion_r234978268 - // There is no overloading in jest so we need to rewrite the config from react-native-jest-preset: - // https://github.com/facebook/react-native/blob/master/jest-preset.json#L20 - 'node_modules/(?!(simple-html-tokenizer|(jest-)?react-native|react-clone-referenced-element))', - ], - snapshotSerializers: [ 'enzyme-to-json/serializer' ], - reporters: [ 'default', 'jest-junit' ], -}; diff --git a/packages/react-native-editor/jest_gb.config.js b/packages/react-native-editor/jest_gb.config.js deleted file mode 100644 index 64fd3485abd366..00000000000000 --- a/packages/react-native-editor/jest_gb.config.js +++ /dev/null @@ -1,9 +0,0 @@ -/** @flow - * @format */ - -const main = require( './jest.config.js' ); - -module.exports = { - ...main, - moduleDirectories: [ 'node_modules', 'symlinked-packages-in-parent' ], -}; diff --git a/test/native/jest.config.js b/test/native/jest.config.js index 7718fa9c4e0d45..0214a229e59173 100644 --- a/test/native/jest.config.js +++ b/test/native/jest.config.js @@ -31,11 +31,13 @@ module.exports = { testEnvironment: 'jsdom', testMatch: [ '**/test/*.native.[jt]s?(x)', + // This is temporary. In the future we should adjust test names to make it seamless for both the web and mobile. + '/packages/react-native-editor/src/**/__tests__/**/*.[jt]s?(x)', + '/packages/react-native-editor/src/**/?(*.)+(spec|test).[jt]s?(x)', ], testPathIgnorePatterns: [ '/node_modules/', '/wordpress/', - '/__device-tests__/', ], testURL: 'http://localhost/', // Add the `Libraries/Utilities` subfolder to the module directories, otherwise haste/jest doesn't find Platform.js on Travis diff --git a/test/native/setup.js b/test/native/setup.js index 94e15dba2c5c49..6dfb37829c4d29 100644 --- a/test/native/setup.js +++ b/test/native/setup.js @@ -3,7 +3,7 @@ */ import { NativeModules } from 'react-native'; -jest.mock( '@wordspress/react-native-bridge', () => { +jest.mock( '@wordpress/react-native-bridge', () => { return { addEventListener: jest.fn(), removeEventListener: jest.fn(),