Skip to content

Commit 86579bd

Browse files
committed
chore: rename options
1 parent 4e467e3 commit 86579bd

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
@@ -374,8 +374,8 @@ interface MeasureRendersOptions {
374374
wrapper?: React.ComponentType<{ children: ReactElement }>;
375375
scenario?: (view?: RenderResult) => Promise<any>;
376376
writeFile?: boolean;
377-
beforeEachRun?: () => Promise<void> | void;
378-
afterEachRun?: () => Promise<void> | void;
377+
beforeEach?: () => Promise<void> | void;
378+
afterEach?: () => Promise<void> | void;
379379
}
380380
```
381381

@@ -385,8 +385,8 @@ interface MeasureRendersOptions {
385385
- **`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.
386386
- **`scenario`**: a custom async function, which defines user interaction within the UI by utilising RNTL or RTL functions
387387
- **`writeFile`**: should write output to file (default `true`)
388-
- **`beforeEachRun`**: function to execute before each test run.
389-
- **`afterEachRun`**: function to execute after each test run.
388+
- **`beforeEach`**: function to execute before each test run.
389+
- **`afterEach`**: function to execute after each test run.
390390

391391
#### `measureFunction` function
392392

@@ -407,17 +407,17 @@ interface MeasureFunctionOptions {
407407
warmupRuns?: number;
408408
removeOutliers?: boolean;
409409
writeFile?: boolean;
410-
beforeEachRun?: () => Promise<void> | void;
411-
afterEachRun?: () => Promise<void> | void;
410+
beforeEach?: () => Promise<void> | void;
411+
afterEach?: () => Promise<void> | void;
412412
}
413413
```
414414

415415
- **`runs`**: number of runs per series for the particular test
416416
- **`warmupRuns`**: number of additional warmup runs that will be done and discarded before the actual runs
417417
- **`removeOutliers`**: should remove statistical outlier results (default: `true`)
418418
- **`writeFile`**: should write output to file (default `true`)
419-
- **`beforeEachRun`**: function to execute before each test run.
420-
- **`afterEachRun`**: function to execute after each test run.
419+
- **`beforeEach`**: function to execute before each test run.
420+
- **`afterEach`**: function to execute after each test run.
421421

422422
#### `measureAsyncFunction` function
423423

@@ -440,17 +440,17 @@ interface MeasureAsyncFunctionOptions {
440440
warmupRuns?: number;
441441
removeOutliers?: boolean;
442442
writeFile?: boolean;
443-
beforeEachRun?: () => Promise<void> | void;
444-
afterEachRun?: () => Promise<void> | void;
443+
beforeEach?: () => Promise<void> | void;
444+
afterEach?: () => Promise<void> | void;
445445
}
446446
```
447447

448448
- **`runs`**: number of runs per series for the particular test
449449
- **`warmupRuns`**: number of additional warmup runs that will be done and discarded before the actual runs
450450
- **`removeOutliers`**: should remove statistical outlier results (default: `true`)
451451
- **`writeFile`**: should write output to file (default `true`)
452-
- **`beforeEachRun`**: function to execute before each test run.
453-
- **`afterEachRun`**: function to execute after each test run.
452+
- **`beforeEach`**: function to execute before each test run.
453+
- **`afterEach`**: function to execute after each test run.
454454

455455
### Configuration
456456

docusaurus/docs/api.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ interface MeasureRendersOptions {
5454
wrapper?: React.ComponentType<{ children: ReactElement }>;
5555
scenario?: (view?: RenderResult) => Promise<any>;
5656
writeFile?: boolean;
57-
beforeEachRun?: () => Promise<void> | void;
58-
afterEachRun?: () => Promise<void> | void;
57+
beforeEach?: () => Promise<void> | void;
58+
afterEach?: () => Promise<void> | void;
5959
}
6060
```
6161
@@ -65,8 +65,8 @@ interface MeasureRendersOptions {
6565
- **`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.
6666
- **`scenario`**: a custom async function, which defines user interaction within the ui by utilized RNTL functions
6767
- **`writeFile`**: (default `true`) should write output to file.
68-
- **`beforeEachRun`**: function to execute before each test run.
69-
- **`afterEachRun`**: function to execute after each test run.
68+
- **`beforeEach`**: function to execute before each test run.
69+
- **`afterEach`**: function to execute after each test run.
7070
7171
### `measureFunction` function {#measure-function}
7272
@@ -99,17 +99,17 @@ interface MeasureFunctionOptions {
9999
warmupRuns?: number;
100100
removeOutliers?: boolean;
101101
writeFile?: boolean;
102-
beforeEachRun?: () => Promise<void> | void;
103-
afterEachRun?: () => Promise<void> | void;
102+
beforeEach?: () => Promise<void> | void;
103+
afterEach?: () => Promise<void> | void;
104104
}
105105
```
106106
107107
- **`runs`**: number of runs per series for the particular test
108108
- **`warmupRuns`**: number of additional warmup runs that will be done and discarded before the actual runs
109109
- **`removeOutliers`**: should remove statistical outlier results (default: `true`)
110110
- **`writeFile`**: should write output to file (default `true`)
111-
- **`beforeEachRun`**: function to execute before each test run.
112-
- **`afterEachRun`**: function to execute after each test run.
111+
- **`beforeEach`**: function to execute before each test run.
112+
- **`afterEach`**: function to execute after each test run.
113113
114114
### `measureAsyncFunction` function {#measure-async-function}
115115
@@ -150,17 +150,17 @@ interface MeasureAsyncFunctionOptions {
150150
warmupRuns?: number;
151151
removeOutliers?: boolean;
152152
writeFile?: boolean;
153-
beforeEachRun?: () => Promise<void> | void;
154-
afterEachRun?: () => Promise<void> | void;
153+
beforeEach?: () => Promise<void> | void;
154+
afterEach?: () => Promise<void> | void;
155155
}
156156
```
157157
158158
- **`runs`**: number of runs per series for the particular test
159159
- **`warmupRuns`**: number of additional warmup runs that will be done and discarded before the actual runs
160160
- **`removeOutliers`**: should remove statistical outlier results (default: `true`)
161161
- **`writeFile`**: (default `true`) should write output to file
162-
- **`beforeEachRun`**: function to execute before each test run.
163-
- **`afterEachRun`**: function to execute after each test run.
162+
- **`beforeEach`**: function to execute before each test run.
163+
- **`afterEach`**: function to execute after each test run.
164164
165165
## Configuration
166166

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
removeOutliers?: 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
@@ -374,8 +374,8 @@ interface MeasureRendersOptions {
374374
wrapper?: React.ComponentType<{ children: ReactElement }>;
375375
scenario?: (view?: RenderResult) => Promise<any>;
376376
writeFile?: boolean;
377-
beforeEachRun?: () => Promise<void> | void;
378-
afterEachRun?: () => Promise<void> | void;
377+
beforeEach?: () => Promise<void> | void;
378+
afterEach?: () => Promise<void> | void;
379379
}
380380
```
381381

@@ -385,8 +385,8 @@ interface MeasureRendersOptions {
385385
- **`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.
386386
- **`scenario`**: a custom async function, which defines user interaction within the UI by utilising RNTL or RTL functions
387387
- **`writeFile`**: should write output to file (default `true`)
388-
- **`beforeEachRun`**: function to execute before each test run.
389-
- **`afterEachRun`**: function to execute after each test run.
388+
- **`beforeEach`**: function to execute before each test run.
389+
- **`afterEach`**: function to execute after each test run.
390390

391391
#### `measureFunction` function
392392

@@ -407,17 +407,17 @@ interface MeasureFunctionOptions {
407407
warmupRuns?: number;
408408
removeOutliers?: boolean;
409409
writeFile?: boolean;
410-
beforeEachRun?: () => Promise<void> | void;
411-
afterEachRun?: () => Promise<void> | void;
410+
beforeEach?: () => Promise<void> | void;
411+
afterEach?: () => Promise<void> | void;
412412
}
413413
```
414414

415415
- **`runs`**: number of runs per series for the particular test
416416
- **`warmupRuns`**: number of additional warmup runs that will be done and discarded before the actual runs
417417
- **`removeOutliers`**: should remove statistical outlier results (default: `true`)
418418
- **`writeFile`**: should write output to file (default `true`)
419-
- **`beforeEachRun`**: function to execute before each test run.
420-
- **`afterEachRun`**: function to execute after each test run.
419+
- **`beforeEach`**: function to execute before each test run.
420+
- **`afterEach`**: function to execute after each test run.
421421

422422
#### `measureAsyncFunction` function
423423

@@ -440,17 +440,17 @@ interface MeasureAsyncFunctionOptions {
440440
warmupRuns?: number;
441441
removeOutliers?: boolean;
442442
writeFile?: boolean;
443-
beforeEachRun?: () => Promise<void> | void;
444-
afterEachRun?: () => Promise<void> | void;
443+
beforeEach?: () => Promise<void> | void;
444+
afterEach?: () => Promise<void> | void;
445445
}
446446
```
447447

448448
- **`runs`**: number of runs per series for the particular test
449449
- **`warmupRuns`**: number of additional warmup runs that will be done and discarded before the actual runs
450450
- **`removeOutliers`**: should remove statistical outlier results (default: `true`)
451451
- **`writeFile`**: should write output to file (default `true`)
452-
- **`beforeEachRun`**: function to execute before each test run.
453-
- **`afterEachRun`**: function to execute after each test run.
452+
- **`beforeEach`**: function to execute before each test run.
453+
- **`afterEach`**: function to execute after each test run.
454454

455455
### Configuration
456456

0 commit comments

Comments
 (0)