Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: retry some jest tests on failure #12298

Merged
merged 10 commits into from Apr 13, 2021
Merged
14 changes: 14 additions & 0 deletions .github/scripts/jest-retry.sh
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

# Ex: bash jest-retry.sh yarn test-viewer

##
# @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
##

set -euxo pipefail

$*
$* --onlyFailures --passWithNoTests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about?

$* || $* --onlyFailures

6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Expand Up @@ -34,13 +34,13 @@ jobs:
# Run tests that require headfull Chrome.
- run: sudo apt-get install xvfb
- name: yarn test-clients
run: xvfb-run --auto-servernum yarn test-clients
run: xvfb-run --auto-servernum bash $GITHUB_WORKSPACE/.github/scripts/jest-retry.sh yarn test-clients
- name: yarn test-docs
run: xvfb-run --auto-servernum yarn test-docs
- name: yarn test-viewer
run: xvfb-run --auto-servernum yarn test-viewer
run: xvfb-run --auto-servernum bash $GITHUB_WORKSPACE/.github/scripts/jest-retry.sh yarn test-viewer
- name: yarn test-treemap
run: xvfb-run --auto-servernum yarn test-treemap
run: xvfb-run --auto-servernum bash $GITHUB_WORKSPACE/.github/scripts/jest-retry.sh yarn test-treemap

- run: yarn diff:sample-json
- run: yarn type-check
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -142,7 +142,7 @@
"glob": "^7.1.3",
"idb-keyval": "2.2.0",
"intl-messageformat-parser": "^1.8.1",
"jest": "^24.9.0",
"jest": "^26.6.1",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment was marked as off-topic.

"jsdom": "^12.2.0",
"lighthouse-plugin-publisher-ads": "^1.3.0",
"lodash.clonedeep": "^4.5.0",
Expand Down