Skip to main content

React Native Unit Test

This component runs all the unit tests in your project written with Jest integration. When this step is completed, it generates a test report file in junit-report.xml format. You can view these test results in detail using Appcircle's Test Report component. To generate detailed Test Reports. Please visit our Test Reports Component documentation.

For detailed information for continuous testing, please visit our React Native Continuous Testing documentation.

Prerequisites

Before running the React Native Unit Test step, you must complete certain prerequisites, as detailed in the table below:

Prerequisite Workflow StepDescription
Git CloneClone the selected repository to the build machine.
Install NodeThis step will install Node modules for your application.
NPM/Yarn CommandsThis step installs the NPM or Yarn package manager to install specific dependencies for your React Native applications.
Screenshot
Step Rule

If any workflow steps fail, Appcircle automatically skips the next steps. However, it is possible that some of your tests may fail. If you have a failing test, Appcircle will break the pipeline. If you want your pipeline not to break even if an error occurs in this step (especially for exporting test reports), you should activate the following option:

  • Continue with the next step even if this step fails to ON
Screenshot

Input Variables

This step contains some input variable(s). It needs these variable(s) to work. The table below gives explanation for this variable(s).

Screenshot
Variable NameDescriptionStatus
$AC_REPOSITORY_DIRSpecifies the cloned repository directory. This path will be generated after the Git Clone step.Required
$AC_OUTPUT_DIRThis variable specifies the path of the artifacts that will be generated after the build is complete.Required
$AC_RN_TEST_COMMAND_ARGSSpecify additional command arguments for running Jest tests. An extra parameter will be added to the end of the command jest. You can add extra arguments, such as --debug --colors, without affecting the default ones. For more information, see the Jest CLI options.Optional
caution

To view the output artifacts on the Download Artifacts page, please ensure that the Export Build Artifacts step is included in your workflow after this step.

Output Variables

The output(s) resulting from the operation of this component are as follows:

Variable NameDescription
AC_TEST_RESULT_PATHThe output path for the junit-report.xml file. This environment variable can be utilized in subsequent steps.
Coverage Support

Appcircle does not currently support test coverage calculation for React Native projects. However, adding this feature is part of our development roadmap and will be included in a future update. We will make it available as soon as development is completed.


To access the source code of this component, please use the following link:

Preview of GitHub - appcircleio/appcircle-react-native-unit-test-component