Skip to content

Commit 47aad73

Browse files
chore: danger report 4x (#52)
* chore: danger 4x * chore: danger config * chore: parallel exec * chore: add danger * chore: separate danger ids * chore: unify tests * chore: final tweaks * chore: update reassure scripts
1 parent 7927ed4 commit 47aad73

27 files changed

+3270
-3096
lines changed

.github/workflows/test-example-apps.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ jobs:
2323
node-version: 20.x
2424
cache: 'yarn'
2525

26-
- name: Install Root
27-
run: yarn install
28-
2926
- name: Install Example
3027
run: yarn --cwd examples/native install
3128

@@ -42,13 +39,12 @@ jobs:
4239
run: cd examples/native && ./reassure-tests.sh
4340

4441
- name: Run Danger.js
45-
run: yarn danger ci
42+
run: yarn --cwd examples/native danger ci --id native
4643
env:
4744
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4845

4946
test-native-expo:
5047
name: Test React Native Expo
51-
needs: test-native
5248
runs-on: ubuntu-latest
5349
steps:
5450
- name: Checkout
@@ -63,9 +59,6 @@ jobs:
6359
node-version: 20.x
6460
cache: 'yarn'
6561

66-
- name: Install Root
67-
run: yarn install
68-
6962
- name: Install Example
7063
run: yarn --cwd examples/native-expo install
7164

@@ -78,9 +71,13 @@ jobs:
7871
- name: Run perf tests
7972
run: cd examples/native-expo && ./reassure-tests.sh
8073

74+
- name: Run Danger.js
75+
run: yarn --cwd examples/native-expo danger ci --id native-expo
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
8179
test-web-vite:
8280
name: Test Vite
83-
needs: test-native
8481
runs-on: ubuntu-latest
8582
steps:
8683
- name: Checkout
@@ -95,9 +92,6 @@ jobs:
9592
node-version: 20.x
9693
cache: 'yarn'
9794

98-
- name: Install Root
99-
run: yarn install
100-
10195
- name: Install Example
10296
run: yarn --cwd examples/web-vite install
10397

@@ -113,9 +107,13 @@ jobs:
113107
- name: Run perf tests
114108
run: cd examples/web-vite && ./reassure-tests.sh
115109

110+
- name: Run Danger.js
111+
run: yarn --cwd examples/web-vite danger ci --id web-vite
112+
env:
113+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114+
116115
test-web-nextjs:
117116
name: Test Next.js
118-
needs: test-native
119117
runs-on: ubuntu-latest
120118
steps:
121119
- name: Checkout
@@ -130,9 +128,6 @@ jobs:
130128
node-version: 20.x
131129
cache: 'yarn'
132130

133-
- name: Install Root
134-
run: yarn install
135-
136131
- name: Install Example
137132
run: yarn --cwd examples/web-nextjs install
138133

@@ -144,3 +139,8 @@ jobs:
144139

145140
- name: Run perf tests
146141
run: cd examples/web-nextjs && ./reassure-tests.sh
142+
143+
- name: Run Danger.js
144+
run: yarn --cwd examples/web-nextjs danger ci --id web-nextjs
145+
env:
146+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

dangerfile.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

examples/native-expo/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"@testing-library/react-native": "^12.5.0",
2424
"@types/jest": "^29.5.12",
2525
"@types/react": "~18.2.79",
26+
"danger": "^12.2.0",
2627
"jest": "^29.7.0",
2728
"react-test-renderer": "^18.2.0",
2829
"reassure": "^1.0.0-rc.4",
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
#!/usr/bin/env bash
2-
BASELINE_BRANCH=${BASELINE_BRANCH:="main"}
2+
set -e
3+
4+
BASELINE_BRANCH=${GITHUB_BASE_REF:="main"}
5+
6+
# Required for `git switch` on CI
7+
git fetch origin
38

49
# Gather baseline perf measurements
510
git switch "$BASELINE_BRANCH"
11+
612
yarn install
713
yarn reassure --baseline
814

915
# Gather current perf measurements & compare results
10-
git switch -
16+
git switch --detach -
17+
1118
yarn install
1219
yarn reassure --branch
Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,31 @@
1-
import * as React from 'react';
2-
import { View, Text, Pressable } from 'react-native';
3-
import { screen, fireEvent } from '@testing-library/react-native';
1+
import React from 'react';
2+
import { jest, test } from '@jest/globals';
3+
import { fireEvent, screen } from '@testing-library/react-native';
44
import { measureRenders } from 'reassure';
5-
import { SlowList } from './SlowList';
5+
import { AsyncComponent } from './AsyncComponent';
66

7-
jest.setTimeout(60_000);
7+
jest.setTimeout(600_000);
88

9-
const AsyncComponent = () => {
10-
const [count, setCount] = React.useState(0);
9+
test('RN Expo - AsyncComponent 10 runs', async () => {
10+
const scenario = async () => {
11+
const button = screen.getByText('Action');
1112

12-
const handlePress = () => {
13-
setTimeout(() => setCount((c) => c + 1), 10);
13+
fireEvent.press(button);
14+
fireEvent.press(button);
15+
await screen.findByText('Count: 2');
1416
};
1517

16-
return (
17-
<View>
18-
<Pressable accessibilityRole="button" onPress={handlePress}>
19-
<Text>Action</Text>
20-
</Pressable>
21-
22-
<Text>Count: {count}</Text>
23-
24-
<SlowList count={200} />
25-
</View>
26-
);
27-
};
18+
await measureRenders(<AsyncComponent />, { scenario, runs: 10 });
19+
});
2820

29-
test('Async Component', async () => {
21+
test('RN Expo - AsyncComponent 50 runs', async () => {
3022
const scenario = async () => {
3123
const button = screen.getByText('Action');
3224

3325
fireEvent.press(button);
34-
await screen.findByText('Count: 1');
35-
3626
fireEvent.press(button);
3727
await screen.findByText('Count: 2');
38-
39-
fireEvent.press(button);
40-
fireEvent.press(button);
41-
fireEvent.press(button);
42-
await screen.findByText('Count: 5');
4328
};
4429

45-
await measureRenders(<AsyncComponent />, { scenario });
30+
await measureRenders(<AsyncComponent />, { scenario, runs: 50 });
4631
});
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import * as React from 'react';
2+
import { View, Text, Pressable } from 'react-native';
3+
import { SlowList } from './SlowList';
4+
5+
export function AsyncComponent() {
6+
const [count, setCount] = React.useState(0);
7+
8+
const handlePress = () => {
9+
setTimeout(() => setCount(c => c + 1), 10);
10+
};
11+
12+
return (
13+
<View>
14+
<Pressable accessibilityRole="button" onPress={handlePress}>
15+
<Text>Action</Text>
16+
</Pressable>
17+
18+
<Text>Count: {count}</Text>
19+
20+
<SlowList count={200} />
21+
</View>
22+
);
23+
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import * as React from 'react';
2+
import { jest, test } from '@jest/globals';
23
import { measureRenders } from 'reassure';
34
import { SlowList } from './SlowList';
45

56
jest.setTimeout(60_000);
67

7-
test('SlowList Component', async () => {
8-
await measureRenders(<SlowList count={500} />);
8+
test('RN Expo - SlowList 100 items', async () => {
9+
await measureRenders(<SlowList count={100} />, { runs: 10 });
910
});

0 commit comments

Comments
 (0)