React Native Quality Control & Assurance 5 — Questions and Answers
Question 1: Which tool provides a dashboard for tracking React Native crash rates, ANRs, and performance in production?
- React Native Debugger
- Firebase Crashlytics (Correct answer)
- Flipper
- Reactotron
Correct answer: Firebase Crashlytics
Firebase Crashlytics collects and reports production crashes, ANRs, and error trends with real-time dashboards.
Question 2: What does `expect(component).toMatchSnapshot()` do when run for the first time in a Jest test?
- It fails the test because no snapshot exists yet
- It creates a new snapshot file and passes the test (Correct answer)
- It compares to an inline snapshot in the test file
- It requires manual approval before saving
Correct answer: It creates a new snapshot file and passes the test
On first run, Jest creates a new .snap file with the serialized component output and the test passes; subsequent runs compare against it.
Question 3: In a React Native CI pipeline, what is the correct order for quality gates?
- E2E tests → unit tests → lint → type check
- Lint → type check → unit tests → E2E tests (Correct answer)
- Unit tests → E2E tests → lint → type check
- Type check → E2E tests → lint → unit tests
Correct answer: Lint → type check → unit tests → E2E tests
Running lint and type checks first catches cheap errors early; unit tests run next, and expensive E2E tests run last to minimize CI time.
Question 4: Which property in `jest.config.js` specifies which files to transform with Babel before running tests?
- moduleNameMapper
- transform (Correct answer)
- setupFilesAfterFramework
- testPathPattern
Correct answer: transform
The transform property maps file patterns to transformer packages (like babel-jest) so Jest can process JSX and modern JS syntax.
Question 5: What is the role of `@testing-library/jest-native` in React Native testing?
- It provides native module mocks for common packages
- It extends Jest with custom matchers like toBeVisible() and toHaveTextContent() (Correct answer)
- It runs tests on actual iOS and Android devices
- It generates accessibility reports from test output
Correct answer: It extends Jest with custom matchers like toBeVisible() and toHaveTextContent()
@testing-library/jest-native adds semantic Jest matchers tailored to React Native elements, making assertions more expressive and readable.
Question 6: When should you use `jest.spyOn()` instead of `jest.fn()` in a React Native test?
- When you want to replace a function with a completely custom implementation
- When you want to observe calls to an existing method while keeping its original implementation by default (Correct answer)
- When you need to mock an entire module's exports
- When the function is asynchronous
Correct answer: When you want to observe calls to an existing method while keeping its original implementation by default
jest.spyOn() wraps an existing method to track calls while preserving the real implementation unless you chain mockImplementation().
Question 7: Which React Native feature helps QA teams reproduce crashes by capturing the exact sequence of user actions leading to an error?
- Redux DevTools time-travel debugging
- Breadcrumb logging in error tracking SDKs like Sentry (Correct answer)
- React Native Inspector overlay
- LogBox error history
Correct answer: Breadcrumb logging in error tracking SDKs like Sentry
Sentry and similar SDKs record breadcrumbs — a trail of events (navigation, taps, network calls) — that show what happened before a crash.
Which tool provides a dashboard for tracking React Native crash rates, ANRs, and performance in production?