Skip to content

Commit

Permalink
update bot for jest tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed May 25, 2018
1 parent 79aa13d commit 713292f
Showing 1 changed file with 93 additions and 34 deletions.
127 changes: 93 additions & 34 deletions open-bot.yaml
Expand Up @@ -59,7 +59,7 @@ rules:



# Report specific error message if mocha for integration tests fails
# Report specific error message if jest for basic tests fails
- filters:
ensure:
value: "{{report_ci}}"
Expand All @@ -71,40 +71,64 @@ rules:
state: "failed"
allow_failure: false
config:
env: JOB_PART=integration
env: JOB_PART=basic
fetch: travis_job.log
string_cleanup:
id: logResult
value: "{{{fetch}}}"
remove:
- "^[\\s\\S]+?\\d+\\s+pending\n+"
- "npm ERR!.*\n"
- "\n*=============================================================================\n[\\s\\S]*"
- "^[\\s\\S]+?\\$ yarn travis:\\$JOB_PART.*\n"
- "\\$ node --max-old-space-size=4096.*\n"
- "^yarn run.+\n"
- "\\(node:\\d+\\) \\[DEP0005\\].+\n"
- "\\$ yarn (cover|test):.+\n"
- "Ran all test suites.\n[\\s\\S]*"
- "PASS test/.*\n"
string_cleanup_1:
id: firstError
value: "{{{logResult}}}"
remove:
- "\\s2\\)\\s[\\s\\S]*"
- "\n\n ●[\\s\\S]*"
- "Test Suites:[\\s\\S]*"
- "\\s+$"
string_cleanup_2:
id: remainingErrors
value: "{{{logResult}}}"
remove:
- "^[\\s\\S]+?(?=\\s2\\)\\s)"
- "^[\\s\\S]+?(?=\n\n ●|$)"
- "^\n+"
- "Test Suites:[\\s\\S]*"
- "\\s+$"
string_cleanup_3:
id: summary
value: "{{{logResult}}}"
remove:
- "^[\\s\\S]+?(?=Test Suites:)"
- "\\s+$"
actions:
comment:
identifier: "ci-result"
message: |-
The basic integration tests failed.
@{{commit.author.login}} Please review the following output log for errors:
```text
{{{firstError}}}
```
{{#if remainingErrors}}
<details>
<summary>Show remaining errors</summary>
```text
{{{remainingErrors}}}
```
</details>
{{/if}}
```text
{{{summary}}}
```
See [complete report here]({{status.target_url}}).
set:
Expand All @@ -113,7 +137,7 @@ rules:



# Report specific error message if mocha for unit tests fails
# Report specific error message if jest for integration tests fails
- filters:
ensure:
value: "{{report_ci}}"
Expand All @@ -125,26 +149,64 @@ rules:
state: "failed"
allow_failure: false
config:
env: JOB_PART=unit
env: JOB_PART=integration
fetch: travis_job.log
string_cleanup:
id: logResult
value: "{{{fetch}}}"
remove:
- "^[\\s\\S]+?\\d+\\s+pending\n+"
- "npm ERR!.*\n"
- "\n*=============================================================================\n[\\s\\S]*"
- "^[\\s\\S]+?\\$ yarn travis:\\$JOB_PART.*\n"
- "\\$ node --max-old-space-size=4096.*\n"
- "^yarn run.+\n"
- "\\(node:\\d+\\) \\[DEP0005\\].+\n"
- "\\$ yarn (cover|test):.+\n"
- "The command \"yarn travis:\\$JOB_PART\" exited[\\s\\S]*"
- "PASS test/.*\n"
string_cleanup_1:
id: firstError
value: "{{{logResult}}}"
remove:
- "\n\n ●[\\s\\S]*"
- "Test Suites:[\\s\\S]*"
- "\\s+$"
string_cleanup_2:
id: remainingErrors
value: "{{{logResult}}}"
remove:
- "^[\\s\\S]+?(?=\n\n ●|$)"
- "^\n+"
- "Test Suites:[\\s\\S]*"
- "\\s+$"
string_cleanup_3:
id: summary
value: "{{{logResult}}}"
remove:
- "^[\\s\\S]+?(?=Test Suites:)"
- "\\s+$"
actions:
comment:
identifier: "ci-result"
message: |-
The basic integration tests succeeded, but the full suite failed.
@{{commit.author.login}} Please review the following output log for errors:
``` text
{{{logResult}}}
```text
{{{firstError}}}
```
{{#if remainingErrors}}
<details>
<summary>Show remaining errors</summary>
Instead of updating these (outdated?) unit tests, you can choose to delete them and add integration tests instead. That would be great.
```text
{{{remainingErrors}}}
```
</details>
{{/if}}
```text
{{{summary}}}
```
See [complete report here]({{status.target_url}}).
set:
Expand All @@ -153,7 +215,7 @@ rules:



# Report specific error message if linting fails
# Report specific error message if jest for unit tests or liniting fails
- filters:
ensure:
value: "{{report_ci}}"
Expand All @@ -163,26 +225,35 @@ rules:
context: "continuous-integration/travis-ci/pr"
travis_job:
state: "failed"
allow_failure: false
config:
env: JOB_PART=lint
env: JOB_PART=lint-unit
fetch: travis_job.log
string_cleanup:
id: logResult
value: "{{{fetch}}}"
remove:
- "^[\\s\\S]+?npm run travis:\\$JOB_PART\n*"
- "npm ERR!.*\n"
- "\n*The command \"npm run travis:\\$JOB_PART\" exited [\\s\\S]*"
- "^[\\s\\S]+?\\$ yarn travis:\\$JOB_PART.*\n"
- "\\$ node --max-old-space-size=4096.*\n"
- "^yarn run.+\n"
- "\\(node:\\d+\\) \\[DEP0005\\].+\n"
- "\\$ yarn (unit|lint).+\n"
- "The command \"yarn travis:\\$JOB_PART\" exited[\\s\\S]*"
- "PASS test/.*\n"
actions:
comment:
identifier: "ci-result"
message: |-
@{{commit.author.login}} The tests look fine, but there are code style issue in your Pull Request. Please review the following:
The integration tests look fine, but there are code style issues or unit test failures in the Pull Request.
@{{commit.author.login}} Please review the following output log for errors:
``` text
{{{logResult}}}
```
If the unit tests are outdated, you can choose to delete them and add integration tests instead. That would be great.
See [complete report here]({{status.target_url}}).
set:
id: report_ci
Expand Down Expand Up @@ -397,18 +468,6 @@ rules:



# add small label to small pull requests
- filters:
open: true
pull_request:
additions: "<= 10"
deletions: "<= 10"
changed_files: "<= 2"
actions:
label: "PR: small"



# add non-master label to pull request to other branch
- filters:
open: true
Expand Down Expand Up @@ -567,7 +626,7 @@ rules:
# Check issues every week
# Check open issues and pull requests every day
- filters:
open: true
actions:
Expand Down

0 comments on commit 713292f

Please sign in to comment.