question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Test suite failed to run- Call retries were exceeded

See original GitHub issue

Environment

  1. node -v: v12.1.0

  2. npm -v: 6.9.0

  3. npm ls jest or npm ls react-scripts (if you haven’t ejected): No

  4. your vscode-jest settings if customized:

    • jest.pathToJest? No
    • jest.pathToConfig? package.json
    • anything else that you think might be relevant? No
  5. Operating system: MACOS MOJAVE - 10.14.5

Prerequisite

  • are you able to run jest test from command line? Yes
  • how do you run your tests from command line? (for example: npm run test or node_modules/.bin/jest) npm test – -u

Steps to Reproduce

when I run npm test – -u the coverage is really bad and the test Fail. I don’t know why this error is happenig…

CLASS

import React, { Component } from 'react';
import {
  View,
  Text,
  TouchableOpacity,
  Image,
  Modal,
} from 'react-native';
import PropTypes from 'prop-types';
import { SafeAreaView } from 'react-navigation';
import styles from './Style';

const bag = require('../../assets/images/icons/addedBag/added_bag.png');

class AddedToBag extends Component {
  static propTypes = {
    hideModal: PropTypes.func,
    modalVisible: PropTypes.bool,
    image: PropTypes.string.isRequired,
    productName: PropTypes.string.isRequired,
    price: PropTypes.string.isRequired,
  };

  static defaultProps = {
    hideModal: () => {},
    modalVisible: false,
  }

  hideModalComponent = () => {
    const { hideModal } = this.props;
    hideModal();
  }

  render() {
    const {
      modalVisible, image, productName, price,
    } = this.props;
    return (
      <Modal
        animationType="slide"
        transparent
        visible={modalVisible}
      >
        <View style={styles.flexView} />

        <SafeAreaView style={styles.view}>
          <View style={styles.titleView}>
            <Text style={styles.titleText}>
              ADICIONADO
            </Text>
          </View>
          <View style={styles.productView}>
            <View>
              <Image
                style={styles.productImage}
                source={{ uri: image }}
              />
            </View>
            <View style={styles.flexView}>
              <Text
                style={styles.productText}
                numberOfLines={1}
                ellipsizeMode="tail"
              >
                {productName}
              </Text>
              <Text style={styles.productPriceText}>
                R$ 69,90
              </Text>
            </View>
          </View>
          <View style={styles.buttonView}>
            <TouchableOpacity
              style={styles.buttonTouchable}
              onPress={this.hideModalComponent}
            >
              <Image
                source={bag}
              />
              <Text style={styles.buttonText}>
                IR PARA SACOLA
              </Text>
            </TouchableOpacity>
          </View>
        </SafeAreaView>
      </Modal>
    );
  }
}

export default AddedToBag;

TEST

import 'react-native';
import React from 'react';
import renderer from 'react-test-renderer';
import AddedToBag from '../../src/components/modalBag/AddedToBag';

describe('Test Added To Bag', () => {
  function doWork() {
    console.log('Back button was clicked!');
  }

  test('Added to bag renders correctly', () => {
    const props = {
      hideModal: doWork,
      modalVisible: true,
      image: '',
      productName: 'Test Bag',
      price: '500,50',
    };

    const addedToBag = renderer
      .create(<AddedToBag {...props} />)
      .toJSON();
    expect(addedToBag).toMatchSnapshot();
  });
});


CONSOLE

FAIL  __tests__/components/AddedToBag-test.js
 ● Test suite failed to run

   Call retries were exceeded

     at ChildProcessWorker.initialize (node_modules/jest-runner/node_modules/jest-worker/build/workers/ChildProcessWorker.js:193:21)

PACKAGE.JSON "jest": { "preset": "react-native", "transformIgnorePatterns": [ "node_modules/(?!(jest-)?react-native|react-navigation|react-navigation-redux-helpers|@react-navigation|@react-native-community|rn-sliding-up-panel|react-native-safe-area/.*)" ], "setupFiles": [ "./node_modules/react-native-gesture-handler/jestSetup.js", "./__mocks__/@react-native-community/jestSetupFile.js" ], "testMatch": [ "<rootDir>/__tests__/**/*-test.js?(x)" ], "testPathIgnorePatterns": [ "/node_modules/", "<rootDir>/ios" ], "verbose": true, "setupFilesAfterEnv": [ "<rootDir>/__tests__/setup-tests.js" ] },

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

5reactions
antony2025commented, Nov 27, 2019

In one of our projects, -i results in segmentation fault. Node version: 13.2.0. The observation is same as mentioned here: https://github.com/facebook/jest/issues/8769#issuecomment-558670948

Tests run fine with Node version 12.13.1.

2reactions
justinlazaro-iselectcommented, Sep 18, 2020

any fixed on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest failing with "Call retries were exceeded", using ... - GitHub
In CI they fail with this error: ○ Test suite failed to run Call retries were exceeded at ChildProcessWorker.initialize (.
Read more >
Jest Call retries were exceeded - Stack Overflow
Solution: Try running one test separately then see what error is coming. I got the below error after running one problematic test separately ......
Read more >
[Solved]-Jest Call retries were exceeded-babel.js
I was able to run the test's successfully doing the following;. Install npm i -D jest-canvas-mock. Update the jest.config.ts file to have: export ......
Read more >
Developers - Jest failing with "Call retries were exceeded", using
This instantiation seems to stall for some reason when running the test in CI. Locally running jest passes the tests fine.
Read more >
Node issue–Call retries were exceeded - The art of simplicity
An unhandled exception occurred: Call retries were exceeded ... a look at the following code inside a test project: My first guess would...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found