Gutenberg-mobile: Mobile unit tests are failing on Gutenberg CI

Created on 5 Sep 2019  ·  5Comments  ·  Source: wordpress-mobile/gutenberg-mobile

The JS mobile unit tests are currently failing on the Gutenberg CI with the multiple instances of this error:

FAIL ../../packages/rich-text/src/component/test/index.native.js
  ● Test suite failed to run
    Cannot find module 'Platform' from 'react-native-implementation.js'

    However, Jest was able to find:
        '../index.js'
        '../index.native.js'

    You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'json', 'jsx', 'ts', 'tsx', 'node'].

    See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string

      4 | import { StyleSheet, TouchableOpacity, Text, View, Platform } from 'react-native';
      5 | 
    > 6 | const isAndroid = Platform.OS === 'android';
        |                   ^
      7 | const marginBottom = isAndroid ? -0.5 : 0;
      8 | const marginLeft = -3;
      9 | 
      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:229:17)
      at Object.require [as Platform] (node_modules/react-native/Libraries/react-native/react-native-implementation.js:325:12)
      at Object.Platform (packages/components/src/button/index.native.js:6:19)

Example: Travis Job failing, on this PR

The Travis job is set to "This job is allowed to fail." so it doesn't block the PRs but, we need to fix this in order to move to the next steps.

Testing

All 5 comments

Following up on our weekly hangout yesterday, let's put this ticket back into the "Open Beta" project column and un-assign people from it. We'll get back to it very soon.

👋 @JavonDavis , can you have a look when you get the chance? Thanks!

Here's a recent PR that the mobile Jest tests on Gutenberg fail: PR, the Travis job page, and the failing log line in Travis.

@hypest sure I can take a look at this!

I think I managed to replicate the issue by running the (Gutenberg side) tests on an Ubuntu VM locally. Opened https://github.com/WordPress/gutenberg/pull/18378 in an attempt to fix this.

I think I managed to replicate the issue by running the (Gutenberg side) tests on an Ubuntu VM locally. Opened WordPress/gutenberg#18378 in an attempt to fix this.

Interesting 🤔@hypest thanks for getting to that for me 🙇 I just hadn't gotten a chance to really look into it as yet! I'll give the PR a go 👍

Was this page helpful?
0 / 5 - 0 ratings