Skip to content

Commit c1bd2a9

Browse files
committed
docs: update website
1 parent f184bd3 commit c1bd2a9

2 files changed

Lines changed: 47 additions & 21 deletions

File tree

website/src/docs/getting-started/configuration.mdx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ The most basic configuration would, assuming you support both iOS and Android pl
88

99
```javascript
1010
const config = {
11+
entryPoint: './index.js',
12+
appRegistryComponentName: 'App',
1113
include: ['./src/**/*.harness.{js,ts,jsx,tsx}'],
1214

1315
runners: [
@@ -30,10 +32,49 @@ const config = {
3032
export default config;
3133
```
3234

35+
## Entry Point and App Component
36+
37+
React Native Harness needs to know how to locate and integrate with your React Native app.
38+
39+
### `entryPoint`
40+
41+
The path to your React Native app's entry point file.
42+
43+
```javascript
44+
{
45+
entryPoint: './src/main.tsx',
46+
}
47+
```
48+
49+
### `appRegistryComponentName`
50+
51+
The name of the component registered with React Native's `AppRegistry`.
52+
53+
```javascript
54+
// In your app's entry point
55+
import { AppRegistry } from 'react-native';
56+
import App from './App';
57+
58+
AppRegistry.registerComponent('MyApp', () => App);
59+
```
60+
61+
```javascript
62+
// In your rn-harness.config.mjs
63+
{
64+
appRegistryComponentName: 'MyApp',
65+
}
66+
```
67+
3368
## All Configuration Options
3469

3570
```typescript
3671
{
72+
// Required: Entry point file for your React Native app
73+
entryPoint: string;
74+
75+
// Required: Name of the component registered with AppRegistry
76+
appRegistryComponentName: string;
77+
3778
// Required: Glob patterns to include test files
3879
include: string | string[];
3980

website/src/docs/getting-started/quick-start.mdx

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Create a `rn-harness.config.mjs` file in your project root:
1818

1919
```javascript
2020
const config = {
21+
entryPoint: './index.js',
22+
appRegistryComponentName: 'YourAppName',
2123
include: ['./src/**/*.harness.{js,ts,jsx,tsx}'],
2224

2325
runners: [
@@ -40,7 +42,9 @@ const config = {
4042
export default config;
4143
```
4244

43-
For detailed information about all configuration options, see the [Configuration](/docs/getting-started/configuration) page.
45+
:::tip App Integration
46+
The `entryPoint` and `appRegistryComponentName` properties tell React Native Harness how to locate and integrate with your React Native app. See the [Configuration](/docs/getting-started/configuration) page for detailed information about these and all other configuration options.
47+
:::
4448

4549
### 2. Update Metro Configuration
4650

@@ -70,33 +74,14 @@ module.exports = {
7074
};
7175
```
7276

73-
### 4. Update Your Entry Point
74-
75-
Add a conditional entry point to your `index.js` or main entry file. This allows React Native Harness to take over the app when needed and run tests.
76-
77-
```javascript
78-
// index.js (or your main entry file)
79-
import { AppRegistry } from 'react-native';
80-
81-
AppRegistry.registerComponent(
82-
'YourAppName',
83-
() =>
84-
global.RN_HARNESS
85-
? require('react-native-harness').ReactNativeHarness
86-
: require('./App').default // Your normal app component
87-
);
88-
```
89-
90-
### 5. TypeScript Support (Optional)
77+
### 4. TypeScript Support (Optional)
9178

9279
If you're using TypeScript, add a `react-native-harness.d.ts` file to your project root to get proper type definitions:
9380

9481
```typescript
9582
/// <reference types="react-native-harness/types" />
9683
```
9784

98-
This way, your app will know about the RN_HARNESS global and won't mark it as an error.
99-
10085
## Writing Your First Test
10186

10287
Create a test file with a `.harness.js` or `.harness.ts` extension. Import testing utilities from `react-native-harness` instead of Jest:

0 commit comments

Comments
 (0)