Skip to content

Commit 713292f

Browse files
committed
update bot for jest tests
1 parent 79aa13d commit 713292f

File tree

1 file changed

+93
-34
lines changed

1 file changed

+93
-34
lines changed

open-bot.yaml

Lines changed: 93 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ rules:
5959

6060

6161

62-
# Report specific error message if mocha for integration tests fails
62+
# Report specific error message if jest for basic tests fails
6363
- filters:
6464
ensure:
6565
value: "{{report_ci}}"
@@ -71,40 +71,64 @@ rules:
7171
state: "failed"
7272
allow_failure: false
7373
config:
74-
env: JOB_PART=integration
74+
env: JOB_PART=basic
7575
fetch: travis_job.log
7676
string_cleanup:
7777
id: logResult
7878
value: "{{{fetch}}}"
7979
remove:
80-
- "^[\\s\\S]+?\\d+\\s+pending\n+"
81-
- "npm ERR!.*\n"
82-
- "\n*=============================================================================\n[\\s\\S]*"
80+
- "^[\\s\\S]+?\\$ yarn travis:\\$JOB_PART.*\n"
81+
- "\\$ node --max-old-space-size=4096.*\n"
82+
- "^yarn run.+\n"
83+
- "\\(node:\\d+\\) \\[DEP0005\\].+\n"
84+
- "\\$ yarn (cover|test):.+\n"
85+
- "Ran all test suites.\n[\\s\\S]*"
86+
- "PASS test/.*\n"
8387
string_cleanup_1:
8488
id: firstError
8589
value: "{{{logResult}}}"
8690
remove:
87-
- "\\s2\\)\\s[\\s\\S]*"
91+
- "\n\n ●[\\s\\S]*"
92+
- "Test Suites:[\\s\\S]*"
93+
- "\\s+$"
8894
string_cleanup_2:
8995
id: remainingErrors
9096
value: "{{{logResult}}}"
9197
remove:
92-
- "^[\\s\\S]+?(?=\\s2\\)\\s)"
98+
- "^[\\s\\S]+?(?=\n\n ●|$)"
99+
- "^\n+"
100+
- "Test Suites:[\\s\\S]*"
101+
- "\\s+$"
102+
string_cleanup_3:
103+
id: summary
104+
value: "{{{logResult}}}"
105+
remove:
106+
- "^[\\s\\S]+?(?=Test Suites:)"
107+
- "\\s+$"
93108
actions:
94109
comment:
95110
identifier: "ci-result"
96111
message: |-
112+
The basic integration tests failed.
113+
97114
@{{commit.author.login}} Please review the following output log for errors:
115+
98116
```text
99117
{{{firstError}}}
100118
```
119+
{{#if remainingErrors}}
101120
<details>
102121
<summary>Show remaining errors</summary>
103122
104123
```text
105124
{{{remainingErrors}}}
106125
```
107126
</details>
127+
{{/if}}
128+
129+
```text
130+
{{{summary}}}
131+
```
108132
109133
See [complete report here]({{status.target_url}}).
110134
set:
@@ -113,7 +137,7 @@ rules:
113137

114138

115139

116-
# Report specific error message if mocha for unit tests fails
140+
# Report specific error message if jest for integration tests fails
117141
- filters:
118142
ensure:
119143
value: "{{report_ci}}"
@@ -125,26 +149,64 @@ rules:
125149
state: "failed"
126150
allow_failure: false
127151
config:
128-
env: JOB_PART=unit
152+
env: JOB_PART=integration
129153
fetch: travis_job.log
130154
string_cleanup:
131155
id: logResult
132156
value: "{{{fetch}}}"
133157
remove:
134-
- "^[\\s\\S]+?\\d+\\s+pending\n+"
135-
- "npm ERR!.*\n"
136-
- "\n*=============================================================================\n[\\s\\S]*"
158+
- "^[\\s\\S]+?\\$ yarn travis:\\$JOB_PART.*\n"
159+
- "\\$ node --max-old-space-size=4096.*\n"
160+
- "^yarn run.+\n"
161+
- "\\(node:\\d+\\) \\[DEP0005\\].+\n"
162+
- "\\$ yarn (cover|test):.+\n"
163+
- "The command \"yarn travis:\\$JOB_PART\" exited[\\s\\S]*"
164+
- "PASS test/.*\n"
165+
string_cleanup_1:
166+
id: firstError
167+
value: "{{{logResult}}}"
168+
remove:
169+
- "\n\n ●[\\s\\S]*"
170+
- "Test Suites:[\\s\\S]*"
171+
- "\\s+$"
172+
string_cleanup_2:
173+
id: remainingErrors
174+
value: "{{{logResult}}}"
175+
remove:
176+
- "^[\\s\\S]+?(?=\n\n ●|$)"
177+
- "^\n+"
178+
- "Test Suites:[\\s\\S]*"
179+
- "\\s+$"
180+
string_cleanup_3:
181+
id: summary
182+
value: "{{{logResult}}}"
183+
remove:
184+
- "^[\\s\\S]+?(?=Test Suites:)"
185+
- "\\s+$"
137186
actions:
138187
comment:
139188
identifier: "ci-result"
140189
message: |-
190+
The basic integration tests succeeded, but the full suite failed.
191+
141192
@{{commit.author.login}} Please review the following output log for errors:
142193
143-
``` text
144-
{{{logResult}}}
194+
```text
195+
{{{firstError}}}
145196
```
197+
{{#if remainingErrors}}
198+
<details>
199+
<summary>Show remaining errors</summary>
146200
147-
Instead of updating these (outdated?) unit tests, you can choose to delete them and add integration tests instead. That would be great.
201+
```text
202+
{{{remainingErrors}}}
203+
```
204+
</details>
205+
{{/if}}
206+
207+
```text
208+
{{{summary}}}
209+
```
148210
149211
See [complete report here]({{status.target_url}}).
150212
set:
@@ -153,7 +215,7 @@ rules:
153215

154216

155217

156-
# Report specific error message if linting fails
218+
# Report specific error message if jest for unit tests or liniting fails
157219
- filters:
158220
ensure:
159221
value: "{{report_ci}}"
@@ -163,26 +225,35 @@ rules:
163225
context: "continuous-integration/travis-ci/pr"
164226
travis_job:
165227
state: "failed"
228+
allow_failure: false
166229
config:
167-
env: JOB_PART=lint
230+
env: JOB_PART=lint-unit
168231
fetch: travis_job.log
169232
string_cleanup:
170233
id: logResult
171234
value: "{{{fetch}}}"
172235
remove:
173-
- "^[\\s\\S]+?npm run travis:\\$JOB_PART\n*"
174-
- "npm ERR!.*\n"
175-
- "\n*The command \"npm run travis:\\$JOB_PART\" exited [\\s\\S]*"
236+
- "^[\\s\\S]+?\\$ yarn travis:\\$JOB_PART.*\n"
237+
- "\\$ node --max-old-space-size=4096.*\n"
238+
- "^yarn run.+\n"
239+
- "\\(node:\\d+\\) \\[DEP0005\\].+\n"
240+
- "\\$ yarn (unit|lint).+\n"
241+
- "The command \"yarn travis:\\$JOB_PART\" exited[\\s\\S]*"
242+
- "PASS test/.*\n"
176243
actions:
177244
comment:
178245
identifier: "ci-result"
179246
message: |-
180-
@{{commit.author.login}} The tests look fine, but there are code style issue in your Pull Request. Please review the following:
247+
The integration tests look fine, but there are code style issues or unit test failures in the Pull Request.
248+
249+
@{{commit.author.login}} Please review the following output log for errors:
181250
182251
``` text
183252
{{{logResult}}}
184253
```
185254
255+
If the unit tests are outdated, you can choose to delete them and add integration tests instead. That would be great.
256+
186257
See [complete report here]({{status.target_url}}).
187258
set:
188259
id: report_ci
@@ -397,18 +468,6 @@ rules:
397468

398469

399470

400-
# add small label to small pull requests
401-
- filters:
402-
open: true
403-
pull_request:
404-
additions: "<= 10"
405-
deletions: "<= 10"
406-
changed_files: "<= 2"
407-
actions:
408-
label: "PR: small"
409-
410-
411-
412471
# add non-master label to pull request to other branch
413472
- filters:
414473
open: true
@@ -567,7 +626,7 @@ rules:
567626
568627
569628
570-
# Check issues every week
629+
# Check open issues and pull requests every day
571630
- filters:
572631
open: true
573632
actions:

0 commit comments

Comments
 (0)