Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ts-jest issue in React Native version 0.56 #21418

Closed
2 tasks done
siuhangw opened this issue Sep 29, 2018 · 2 comments
Closed
2 tasks done

ts-jest issue in React Native version 0.56 #21418

siuhangw opened this issue Sep 29, 2018 · 2 comments
Labels
Resolution: Locked This issue was locked by the bot. 🔩Test Infrastructure Test infrastructure and continuous integration.

Comments

@siuhangw
Copy link

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.

@alexmbp
Copy link

alexmbp commented Oct 1, 2018

@siuhangw Check you jest config
"transform": { "^.+\\.(js|jsx)$": "<rootDir>/node_modules/react-native/jest/preprocessor.js", "\\.(ts|tsx)$": "ts-jest" },

It has to use different preprocessor now

@kelset
Copy link
Collaborator

kelset commented Dec 17, 2018

Thanks @alexmbp for replying, it seems that your solution was the correct one since there has been no further activity. Closing.

@kelset kelset closed this as completed Dec 17, 2018
@kelset kelset added the 🔩Test Infrastructure Test infrastructure and continuous integration. label Dec 17, 2018
@facebook facebook locked as resolved and limited conversation to collaborators Dec 17, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Dec 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot. 🔩Test Infrastructure Test infrastructure and continuous integration.
Projects
None yet
Development

No branches or pull requests

4 participants