RE

React Native

@testing-library/react-native

Simple and complete React Native testing utilities that encourage good testing practices.

React Native Libraries
react-native
react
test
integration
@testing-library/react-native
React Native Libraries
javascript
npm
frontend
open source
Stars
3.4k
Weekly
2.7M
Open issues
11
Bundle
~25 kB

Installation

npm install @testing-library/react-native

Code example

import { View, Text, StyleSheet } from "react-native";
import { Native } from "@testing-library/react-native";

export function Example() {
  return (
    <View style={styles.box}>
      <Text style={styles.title}>React Native</Text>
      <Native />
    </View>
  );
}

const styles = StyleSheet.create({
  box: { flex: 1, alignItems: "center", justifyContent: "center", gap: 8 },
  title: { fontSize: 18, fontWeight: "600" },
});

Pros & cons

Pros

  • Actively maintained by Maciej Jastrzębski
  • 2.7M weekly downloads. Battle tested
  • First-class TypeScript definitions
  • MIT licensed

Considerations

  • Adds roughly ~25 kB to your bundle
  • Needs client-only rendering in SSR frameworks
  • 11 open issues on GitHub

FAQs

Alternatives & similar libraries