Skip to content

Commit 332c724

Browse files
chore: prettier check (#1821)
1 parent f71b701 commit 332c724

File tree

21 files changed

+60
-44
lines changed

21 files changed

+60
-44
lines changed

.codecov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ coverage:
88
target: 80% # Required patch coverage target
99
project:
1010
default:
11-
threshold: 0.5% # Allowable coverage drop in percentage points
11+
threshold: 0.5% # Allowable coverage drop in percentage points
1212

1313
comment:
1414
behavior: default

.github/actions/setup-deps-rn-nightly/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ runs:
2828

2929
- name: Switch to React Native Nightly
3030
run: |
31-
yarn add -D react-native@nightly @react-native/babel-preset@nightly [email protected] [email protected]
31+
yarn add -D react-native@nightly @react-native/babel-preset@nightly [email protected] [email protected]
3232
shell: bash

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727
- name: Lint
2828
run: yarn lint
2929

30+
- name: Prettier
31+
run: yarn prettier
32+
3033
typecheck:
3134
runs-on: ubuntu-latest
3235
name: Typecheck

.github/workflows/website.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ jobs:
5454
# The GH actions bot is used by default if you didn't specify the two fields.
5555
# You can swap them out with your own user credentials.
5656
user_name: github-actions[bot]
57-
user_email: 41898282+github-actions[bot]@users.noreply.github.com
57+
user_email: 41898282+github-actions[bot]@users.noreply.github.com

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
.yarn
3+
4+
flow-typed/

CLAUDE.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,26 @@ This is the **React Native Testing Library (RNTL)** - a comprehensive testing so
99
## Key Development Commands
1010

1111
### Testing
12+
1213
- `yarn test` - Run all tests
1314
- `yarn test:ci` - Run tests with CI optimizations (maxWorkers=2)
1415
- `yarn test:ci:coverage` - Run tests with coverage reporting
1516

1617
### Building
18+
1719
- `yarn build` - Full build process (clean, build JS, build types, copy flow types)
1820
- `yarn build:js` - Build JavaScript using Babel
1921
- `yarn build:ts` - Build TypeScript declarations
2022
- `yarn clean` - Clean build directory
2123

2224
### Code Quality
25+
2326
- `yarn typecheck` - Run TypeScript compiler
2427
- `yarn lint` - Run ESLint with caching
2528
- `yarn validate` - Run lint + typecheck + test (pre-commit validation)
2629

2730
### Testing Single Files
31+
2832
To test a specific file: `yarn test path/to/test.test.tsx`
2933

3034
## Architecture Overview
@@ -47,6 +51,7 @@ To test a specific file: `yarn test path/to/test.test.tsx`
4751
### Query System
4852

4953
The library provides three query variants for each selector:
54+
5055
- `get*` - Throws if not found (for assertions)
5156
- `query*` - Returns null if not found (for conditional logic)
5257
- `find*` - Returns Promise, waits for element (for async operations)
@@ -59,37 +64,43 @@ The library provides three query variants for each selector:
5964
## Configuration
6065

6166
### Jest Setup
67+
6268
- Main Jest config: `jest.config.js`
6369
- Setup file: `jest-setup.ts`
6470
- Uses React Native preset with custom transform ignore patterns
6571

6672
### TypeScript
73+
6774
- Main config: `tsconfig.json` (development)
6875
- Release config: `tsconfig.release.json` (for builds)
6976
- Strict mode enabled with ES2022 target
7077

7178
### ESLint
79+
7280
- Config: `eslint.config.mjs`
7381
- Uses Callstack config + TypeScript strict rules
7482
- Custom rules for import sorting and test files
7583

7684
## Testing Patterns
7785

7886
### Component Testing
87+
7988
```jsx
8089
import { render, screen, userEvent } from '@testing-library/react-native';
8190

8291
test('component behavior', async () => {
8392
const user = userEvent.setup();
8493
render(<MyComponent />);
85-
94+
8695
await user.press(screen.getByRole('button'));
8796
expect(screen.getByText('Expected text')).toBeOnTheScreen();
8897
});
8998
```
9099

91100
### Async Testing
101+
92102
Use `findBy*` queries or `waitFor` for async operations:
103+
93104
```jsx
94105
const element = await screen.findByText('Async content');
95106
await waitFor(() => expect(mockFn).toHaveBeenCalled());
@@ -105,6 +116,7 @@ await waitFor(() => expect(mockFn).toHaveBeenCalled());
105116
## Build Process
106117

107118
The build creates:
119+
108120
- `build/` - Compiled JavaScript and TypeScript declarations
109121
- `matchers.js` - Jest matchers for separate import
110122
- `pure.js` - Pure version without auto-cleanup
@@ -122,4 +134,4 @@ The build creates:
122134
- Uses `react-test-renderer` for component rendering
123135
- Fake timers recommended for user events
124136
- String validation available for text rendering checks
125-
- Supports both concurrent and legacy React rendering modes
137+
- Supports both concurrent and legacy React rendering modes

eslint.config.mjs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ export default [
5050
'react-native-a11y/has-valid-accessibility-ignores-invert-colors': 'off',
5151
'react-native-a11y/has-valid-accessibility-value': 'off',
5252
'@typescript-eslint/no-explicit-any': 'off',
53-
'jest/no-standalone-expect': [
54-
'error',
55-
{ additionalTestBlockFunctions: ['testGateReact19'] },
56-
],
53+
'jest/no-standalone-expect': ['error', { additionalTestBlockFunctions: ['testGateReact19'] }],
5754
},
5855
},
5956
];

examples/basic/jest.config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module.exports = {
22
preset: 'react-native',
33
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
4-
transformIgnorePatterns: [
5-
'node_modules/(?!(jest-)?react-native|@react-native(-community)?)',
6-
],
4+
transformIgnorePatterns: ['node_modules/(?!(jest-)?react-native|@react-native(-community)?)'],
75
setupFilesAfterEnv: ['./jest-setup.ts'],
86
};

examples/cookbook/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
</p>
44

55
# React Native Testing Library Cookbook App
6+
67
Welcome to the React Native Testing Library (RNTL) Cookbook! This app is designed to provide developers with a collection of best practices, ready-made recipes, and tips & tricks to help you effectively test your React Native applications. Whether you’re just starting out with testing or looking to deepen your skills, this cookbook offers something for everyone.
78

89
Each recipe described in the Cookbook should have a corresponding code example screen in this repo.
@@ -12,19 +13,22 @@ Since examples will showcase usage of different dependencies, the dependencies i
1213
file will grow much larger that in a normal React Native. This is fine 🐶☕️🔥.
1314

1415
## Running the App
16+
1517
1. Clone the repo `git clone [email protected]:callstack/react-native-testing-library.git`
1618
2. Go to the `examples/cookbook` directory `cd examples/cookbook`
1719
3. Install dependencies `yarn`
1820
4. Run the app `yarn start`
1921
5. Run the app either on iOS or Android by clicking on `i` or `a` in the terminal.
2022

2123
## How to Contribute
24+
2225
We invite all developers, from beginners to experts, to contribute your own recipes! If you have a clever solution, best practice, or useful tip, we encourage you to:
2326

2427
1. Submit a Pull Request with your recipe.
2528
2. Join the conversation on GitHub [here](https://github.com/callstack/react-native-testing-library/issues/1624) to discuss ideas, ask questions, or provide feedback.
2629

2730
## Screenshots From the App
31+
2832
| Home Screen | Phonebook with Net. Req. Example |
29-
|-------------------------------------------------------|-----------------------------------------------------------------|
33+
| ----------------------------------------------------- | --------------------------------------------------------------- |
3034
| ![home-screenshot](assets/readme/home-screenshot.png) | ![phonebook-screenshot](assets/readme/phonebook-screenshot.png) |

examples/cookbook/app/network-requests/__tests__/test-utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { User } from '../types';
2-
import {http, HttpResponse} from "msw";
3-
import {setupServer} from "msw/node";
2+
import { http, HttpResponse } from 'msw';
3+
import { setupServer } from 'msw/node';
44

55
// Define request handlers and response resolvers for random user API.
66
// By default, we always return the happy path response.

0 commit comments

Comments
 (0)