Skip to content

Unable to import '@testing-library/react-native' dependency #578

@pratham-srivastava-07

Description

@pratham-srivastava-07

I am trying to test the performance of application using reassure but whenever i am running this command

npx reassure --baseline

i get

❇️ Running performance tests:

  • Baseline: pratham-testing (b758adac3a58059945ad7f96007274805edad40e) - 2025-09-15 13:04:50Z

FAIL tests/NewComponent.perf-test.tsx
× NewComponent (3 ms)

● NewComponent

Unable to import '@testing-library/react-native' dependency

  4 |
  5 | test('NewComponent', async () => {
> 6 |   await measureRenders(<NewComponent />);
    |                       ^
  7 | });

  at resolveTestingLibrary (node_modules/@callstack/reassure-measure/src/testing-library.ts:30:15)  
  at measureRendersInternal (node_modules/@callstack/reassure-measure/src/measure-renders.tsx:63:52)
  at measureRendersInternal (node_modules/@callstack/reassure-measure/src/measure-renders.tsx:31:23)
  at Object.<anonymous> (tests/NewComponent.perf-test.tsx:6:23)
  at asyncGeneratorStep (node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:17)
  at _next (node_modules/@babel/runtime/helpers/asyncToGenerator.js:17:9)
  at node_modules/@babel/runtime/helpers/asyncToGenerator.js:22:7
  at Object.<anonymous> (node_modules/@babel/runtime/helpers/asyncToGenerator.js:14:12)

Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 3.399 s, estimated 5 s
Ran all test suites.

❌ Test runner (D:\pitstopAi-v2\node_modules\jest\bin\jest.js) exited with error code 1

What i have tried :-

according to the readme and docs

i did

babel.config.js

module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
};
};

jest.config.js

module.exports = {
preset: 'react-native',
setupFilesAfterEnv: ['./jest-setup.js'],
};

jest setup.js

import { configure } from 'reassure';

configure({ testingLibrary: 'react-native' });

and the main test file is tests/NewComponent.perf-test.tsx

import NewComponent from "../components/NewComponent";
import * as React from "react"
import {measurePerformance} from "reassure"

jest.setTimeout(60_000)

test("NewComponent", async () => {
await measurePerformance();
})

Any suggestions would be much appreciated,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions