Skip to content

ts-jest issue in React Native version 0.56 #21418

Closed
@siuhangw

Description

@siuhangw

Environment

React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) i5-4260U CPU @ 1.40GHz
Memory: 52.20 MB / 4.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.11.2 - /usr/local/bin/node
Yarn: 1.9.2 - /usr/local/bin/yarn
npm: 5.6.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0
Android SDK:
Build Tools: 25.0.1, 26.0.2, 26.0.3, 27.0.3
API Levels: 19, 23, 25, 26, 27
IDEs:
Android Studio: 3.1 AI-173.4907809
Xcode: 10.0/10A255 - /usr/bin/xcodebuild
npmPackages:
@types/react: ^16.4.14 => 16.4.14
@types/react-native: ^0.57.0 => 0.57.0
react: 16.4.1 => 16.4.1
react-native: 0.56.0 => 0.56.0
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7

Description

Cannot check test case, after run "yarn test" in my react native project

Reproducible Demo

Wongs-MacBook-Air:capstonefrontend siuhang$ yarn test
yarn run v1.9.2
$ jest
ts-jest[main] (WARN) Replace any occurrences of "ts-jest/dist/preprocessor.js" or "/node_modules/ts-jest/preprocessor.js" in the 'transform' section of your Jest config with just "ts-jest".
FAIL tests/App-test.tsx
● Test suite failed to run

/Users/siuhang/Code/capstonefrontend/node_modules/react-native/Libraries/Utilities/Platform.ios.js: Unexpected token, expected { (35:17)

    33 |     return constants ? constants.interfaceIdiom === 'tv' : false;
    34 |   },
  > 35 |   get isTesting(): boolean {
       |                  ^
    36 |     const constants = NativeModules.PlatformConstants;
    37 |     return constants && constants.isTesting;
    38 |   },

Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 4.878s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions