Skip to content

Commit a1759f7

Browse files
committed
chore: rename options
1 parent c9efef9 commit a1759f7

File tree

8 files changed

+52
-52
lines changed

8 files changed

+52
-52
lines changed

README.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,8 @@ interface MeasureRendersOptions {
373373
wrapper?: React.ComponentType<{ children: ReactElement }>;
374374
scenario?: (view?: RenderResult) => Promise<any>;
375375
writeFile?: boolean;
376-
beforeEachRun?: () => Promise<void> | void;
377-
afterEachRun?: () => Promise<void> | void;
376+
beforeEach?: () => Promise<void> | void;
377+
afterEach?: () => Promise<void> | void;
378378
}
379379
```
380380

@@ -383,8 +383,8 @@ interface MeasureRendersOptions {
383383
- **`wrapper`**: React component, such as a `Provider`, which the `ui` will be wrapped with. Note: the render duration of the `wrapper` itself is excluded from the results; only the wrapped component is measured.
384384
- **`scenario`**: a custom async function, which defines user interaction within the UI by utilising RNTL or RTL functions
385385
- **`writeFile`**: (default `true`) should write output to file.
386-
- **`beforeEachRun`**: function to execute before each test run.
387-
- **`afterEachRun`**: function to execute after each test run.
386+
- **`beforeEach`**: function to execute before each test run.
387+
- **`afterEach`**: function to execute after each test run.
388388

389389
#### `measureFunction` function
390390

@@ -404,16 +404,16 @@ interface MeasureFunctionOptions {
404404
runs?: number;
405405
warmupRuns?: number;
406406
writeFile?: boolean;
407-
beforeEachRun?: () => Promise<void> | void;
408-
afterEachRun?: () => Promise<void> | void;
407+
beforeEach?: () => Promise<void> | void;
408+
afterEach?: () => Promise<void> | void;
409409
}
410410
```
411411

412412
- **`runs`**: number of runs per series for the particular test
413413
- **`warmupRuns`**: number of additional warmup runs that will be done and discarded before the actual runs.
414414
- **`writeFile`**: (default `true`) should write output to file.
415-
- **`beforeEachRun`**: function to execute before each test run.
416-
- **`afterEachRun`**: function to execute after each test run.
415+
- **`beforeEach`**: function to execute before each test run.
416+
- **`afterEach`**: function to execute after each test run.
417417

418418
#### `measureAsyncFunction` function
419419

@@ -435,16 +435,16 @@ interface MeasureAsyncFunctionOptions {
435435
runs?: number;
436436
warmupRuns?: number;
437437
writeFile?: boolean;
438-
beforeEachRun?: () => Promise<void> | void;
439-
afterEachRun?: () => Promise<void> | void;
438+
beforeEach?: () => Promise<void> | void;
439+
afterEach?: () => Promise<void> | void;
440440
}
441441
```
442442

443443
- **`runs`**: number of runs per series for the particular test
444444
- **`warmupRuns`**: number of additional warmup runs that will be done and discarded before the actual runs.
445445
- **`writeFile`**: (default `true`) should write output to file.
446-
- **`beforeEachRun`**: function to execute before each test run.
447-
- **`afterEachRun`**: function to execute after each test run.
446+
- **`beforeEach`**: function to execute before each test run.
447+
- **`afterEach`**: function to execute after each test run.
448448

449449
### Configuration
450450

docusaurus/docs/api.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ interface MeasureRendersOptions {
5353
wrapper?: React.ComponentType<{ children: ReactElement }>;
5454
scenario?: (view?: RenderResult) => Promise<any>;
5555
writeFile?: boolean;
56-
beforeEachRun?: () => Promise<void> | void;
57-
afterEachRun?: () => Promise<void> | void;
56+
beforeEach?: () => Promise<void> | void;
57+
afterEach?: () => Promise<void> | void;
5858
}
5959
```
6060
@@ -63,8 +63,8 @@ interface MeasureRendersOptions {
6363
- **`wrapper`**: React component, such as a `Provider`, which the `ui` will be wrapped with. Note: the render duration of the `wrapper` itself is excluded from the results, only the wrapped component is measured.
6464
- **`scenario`**: a custom async function, which defines user interaction within the ui by utilized RNTL functions
6565
- **`writeFile`**: (default `true`) should write output to file.
66-
- **`beforeEachRun`**: function to execute before each test run.
67-
- **`afterEachRun`**: function to execute after each test run.
66+
- **`beforeEach`**: function to execute before each test run.
67+
- **`afterEach`**: function to execute after each test run.
6868
6969
### `measureFunction` function {#measure-function}
7070
@@ -96,16 +96,16 @@ interface MeasureFunctionOptions {
9696
runs?: number;
9797
warmupRuns?: number;
9898
writeFile?: boolean;
99-
beforeEachRun?: () => Promise<void> | void;
100-
afterEachRun?: () => Promise<void> | void;
99+
beforeEach?: () => Promise<void> | void;
100+
afterEach?: () => Promise<void> | void;
101101
}
102102
```
103103
104104
- **`runs`**: number of runs per series for the particular test
105105
- **`warmupRuns`**: number of additional warmup runs that will be done and discarded before the actual runs.
106106
- **`writeFile`**: (default `true`) should write output to file.
107-
- **`beforeEachRun`**: function to execute before each test run.
108-
- **`afterEachRun`**: function to execute after each test run.
107+
- **`beforeEach`**: function to execute before each test run.
108+
- **`afterEach`**: function to execute after each test run.
109109
110110
### `measureAsyncFunction` function {#measure-async-function}
111111
@@ -145,16 +145,16 @@ interface MeasureAsyncFunctionOptions {
145145
runs?: number;
146146
warmupRuns?: number;
147147
writeFile?: boolean;
148-
beforeEachRun?: () => Promise<void> | void;
149-
afterEachRun?: () => Promise<void> | void;
148+
beforeEach?: () => Promise<void> | void;
149+
afterEach?: () => Promise<void> | void;
150150
}
151151
```
152152
153153
- **`runs`**: number of runs per series for the particular test
154154
- **`warmupRuns`**: number of additional warmup runs that will be done and discarded before the actual runs.
155155
- **`writeFile`**: (default `true`) should write output to file.
156-
- **`beforeEachRun`**: function to execute before each test run.
157-
- **`afterEachRun`**: function to execute after each test run.
156+
- **`beforeEach`**: function to execute before each test run.
157+
- **`afterEach`**: function to execute after each test run.
158158
159159
## Configuration
160160

packages/measure/src/__tests__/measure-function.test.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ test('measureFunction executes setup and cleanup functions for each run', async
6565
runs: 10,
6666
warmupRuns: 1,
6767
writeFile: false,
68-
beforeEachRun: beforeFn,
69-
afterEachRun: afterFn,
68+
beforeEach: beforeFn,
69+
afterEach: afterFn,
7070
});
7171

7272
expect(beforeFn).toHaveBeenCalledTimes(11);
@@ -88,8 +88,8 @@ test('measureAsyncFunction executes setup and cleanup functions for each run', a
8888
runs: 10,
8989
warmupRuns: 1,
9090
writeFile: false,
91-
beforeEachRun: beforeFn,
92-
afterEachRun: afterFn,
91+
beforeEach: beforeFn,
92+
afterEach: afterFn,
9393
});
9494

9595
expect(beforeFn).toHaveBeenCalledTimes(11);

packages/measure/src/__tests__/measure-renders.test.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ test('measureRenders executes setup and cleanup functions for each run', async (
4747
warmupRuns: 1,
4848
scenario,
4949
writeFile: false,
50-
beforeEachRun: beforeFn,
51-
afterEachRun: afterFn,
50+
beforeEach: beforeFn,
51+
afterEach: afterFn,
5252
});
5353

5454
expect(beforeFn).toHaveBeenCalledTimes(11);

packages/measure/src/measure-async-function.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ async function measureAsyncFunctionInternal(
3131

3232
const runResults: RunResult[] = [];
3333
for (let i = 0; i < runs + warmupRuns; i += 1) {
34-
await options?.beforeEachRun?.();
34+
await options?.beforeEach?.();
3535

3636
const timeStart = getCurrentTime();
3737
await fn();
3838
const timeEnd = getCurrentTime();
3939

40-
await options?.afterEachRun?.();
40+
await options?.afterEach?.();
4141

4242
const duration = timeEnd - timeStart;
4343
runResults.push({ duration, count: 1 });

packages/measure/src/measure-function.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ export interface MeasureFunctionOptions {
88
warmupRuns?: number;
99
dropOutliers?: boolean;
1010
writeFile?: boolean;
11-
beforeEachRun?: () => Promise<void> | void;
12-
afterEachRun?: () => Promise<void> | void;
11+
beforeEach?: () => Promise<void> | void;
12+
afterEach?: () => Promise<void> | void;
1313
}
1414

1515
export async function measureFunction(fn: () => void, options?: MeasureFunctionOptions): Promise<MeasureResults> {
@@ -31,13 +31,13 @@ async function measureFunctionInternal(fn: () => void, options?: MeasureFunction
3131

3232
const runResults: RunResult[] = [];
3333
for (let i = 0; i < runs + warmupRuns; i += 1) {
34-
await options?.beforeEachRun?.();
34+
await options?.beforeEach?.();
3535

3636
const timeStart = getCurrentTime();
3737
fn();
3838
const timeEnd = getCurrentTime();
3939

40-
await options?.afterEachRun?.();
40+
await options?.afterEach?.();
4141

4242
const duration = timeEnd - timeStart;
4343
runResults.push({ duration, count: 1 });

packages/measure/src/measure-renders.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ export interface MeasureRendersOptions {
2020
wrapper?: React.ComponentType<{ children: React.ReactElement }>;
2121
scenario?: (screen: any) => Promise<any>;
2222
writeFile?: boolean;
23-
beforeEachRun?: () => Promise<void> | void;
24-
afterEachRun?: () => Promise<void> | void;
23+
beforeEach?: () => Promise<void> | void;
24+
afterEach?: () => Promise<void> | void;
2525
}
2626

2727
export async function measureRenders(
@@ -71,7 +71,7 @@ async function measureRendersInternal(
7171
let initialRenderCount = 0;
7272

7373
for (let iteration = 0; iteration < runs + warmupRuns; iteration += 1) {
74-
await options?.beforeEachRun?.();
74+
await options?.beforeEach?.();
7575

7676
let duration = 0;
7777
let count = 0;
@@ -112,7 +112,7 @@ async function measureRendersInternal(
112112
cleanup();
113113
global.gc?.();
114114

115-
await options?.afterEachRun?.();
115+
await options?.afterEach?.();
116116

117117
runResults.push({ duration, count });
118118
}

packages/reassure/README.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,8 @@ interface MeasureRendersOptions {
373373
wrapper?: React.ComponentType<{ children: ReactElement }>;
374374
scenario?: (view?: RenderResult) => Promise<any>;
375375
writeFile?: boolean;
376-
beforeEachRun?: () => Promise<void> | void;
377-
afterEachRun?: () => Promise<void> | void;
376+
beforeEach?: () => Promise<void> | void;
377+
afterEach?: () => Promise<void> | void;
378378
}
379379
```
380380

@@ -383,8 +383,8 @@ interface MeasureRendersOptions {
383383
- **`wrapper`**: React component, such as a `Provider`, which the `ui` will be wrapped with. Note: the render duration of the `wrapper` itself is excluded from the results; only the wrapped component is measured.
384384
- **`scenario`**: a custom async function, which defines user interaction within the UI by utilising RNTL or RTL functions
385385
- **`writeFile`**: (default `true`) should write output to file.
386-
- **`beforeEachRun`**: function to execute before each test run.
387-
- **`afterEachRun`**: function to execute after each test run.
386+
- **`beforeEach`**: function to execute before each test run.
387+
- **`afterEach`**: function to execute after each test run.
388388

389389
#### `measureFunction` function
390390

@@ -404,16 +404,16 @@ interface MeasureFunctionOptions {
404404
runs?: number;
405405
warmupRuns?: number;
406406
writeFile?: boolean;
407-
beforeEachRun?: () => Promise<void> | void;
408-
afterEachRun?: () => Promise<void> | void;
407+
beforeEach?: () => Promise<void> | void;
408+
afterEach?: () => Promise<void> | void;
409409
}
410410
```
411411

412412
- **`runs`**: number of runs per series for the particular test
413413
- **`warmupRuns`**: number of additional warmup runs that will be done and discarded before the actual runs.
414414
- **`writeFile`**: (default `true`) should write output to file.
415-
- **`beforeEachRun`**: function to execute before each test run.
416-
- **`afterEachRun`**: function to execute after each test run.
415+
- **`beforeEach`**: function to execute before each test run.
416+
- **`afterEach`**: function to execute after each test run.
417417

418418
#### `measureAsyncFunction` function
419419

@@ -435,16 +435,16 @@ interface MeasureAsyncFunctionOptions {
435435
runs?: number;
436436
warmupRuns?: number;
437437
writeFile?: boolean;
438-
beforeEachRun?: () => Promise<void> | void;
439-
afterEachRun?: () => Promise<void> | void;
438+
beforeEach?: () => Promise<void> | void;
439+
afterEach?: () => Promise<void> | void;
440440
}
441441
```
442442

443443
- **`runs`**: number of runs per series for the particular test
444444
- **`warmupRuns`**: number of additional warmup runs that will be done and discarded before the actual runs.
445445
- **`writeFile`**: (default `true`) should write output to file.
446-
- **`beforeEachRun`**: function to execute before each test run.
447-
- **`afterEachRun`**: function to execute after each test run.
446+
- **`beforeEach`**: function to execute before each test run.
447+
- **`afterEach`**: function to execute after each test run.
448448

449449
### Configuration
450450

0 commit comments

Comments
 (0)