Skip to content

Commit

Permalink
tests: retry some jest tests on failure (#12298)
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark committed Apr 13, 2021
1 parent 802947d commit 4a6a1c0
Show file tree
Hide file tree
Showing 4 changed files with 1,453 additions and 1,105 deletions.
13 changes: 13 additions & 0 deletions .github/scripts/jest-retry.sh
@@ -0,0 +1,13 @@
#!/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
8 changes: 4 additions & 4 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 Expand Up @@ -127,7 +127,7 @@ jobs:

# For windows, just test the potentially platform-specific code.
- name: yarn unit-cli
run: yarn unit-cli
run: yarn unit-cli || yarn unit-cli --onlyFailures
if: matrix.os == 'windows-latest'
- run: yarn diff:sample-json
if: matrix.os == 'windows-latest'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -138,7 +138,7 @@
"glob": "^7.1.3",
"idb-keyval": "2.2.0",
"intl-messageformat-parser": "^1.8.1",
"jest": "^24.9.0",
"jest": "^26.6.1",
"jsdom": "^12.2.0",
"lighthouse-plugin-publisher-ads": "^1.3.0",
"lodash.clonedeep": "^4.5.0",
Expand Down

0 comments on commit 4a6a1c0

Please sign in to comment.