Skip to content
Latchkey

Browser Tests workflow (jquery/jquery)

The Browser Tests workflow from jquery/jquery, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get run de-duplication, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: jquery/jquery.github/workflows/browser-tests.ymlLicense MITView source

What it does

This is the Browser Tests workflow from the jquery/jquery repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: Browser Tests

on:
  pull_request:
  push:
    branches-ignore: "dependabot/**"

permissions:
  contents: read # to fetch code (actions/checkout)

env:
  NODE_VERSION: 24.x

jobs:
  build-and-test:
    runs-on: ubuntu-latest
    name: ${{ matrix.NPM_SCRIPT }} - ${{ matrix.NAME }}
    strategy:
      fail-fast: false
      matrix:
        NAME: ["Chrome"]
        NPM_SCRIPT: ["test:slim", "test:no-deprecated", "test:selector-native", "test:esm"]
        include:
          - NAME: "Chrome/Firefox"
            NPM_SCRIPT: "test:browser"
          - NAME: "Firefox ESR (new)"
            NPM_SCRIPT: "test:firefox"
          - NAME: "Firefox ESR (old)"
            NPM_SCRIPT: "test:firefox"
    steps:
      - name: Checkout
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

      - name: Use Node.js ${{ env.NODE_VERSION }}
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
        with:
          node-version: ${{ env.NODE_VERSION }}
          cache: npm
          cache-dependency-path: '**/package-lock.json'

      - name: Set download URL for Firefox ESR (old)
        run: |
          echo "FIREFOX_SOURCE_URL=https://download.mozilla.org/?product=firefox-esr-latest-ssl&lang=en-US&os=linux64" >> "$GITHUB_ENV"
        if: contains(matrix.NAME, 'Firefox ESR (old)')

      - name: Set download URL for Firefox ESR (new)
        run: |
          echo "FIREFOX_SOURCE_URL=https://download.mozilla.org/?product=firefox-esr-next-latest-ssl&lang=en-US&os=linux64" >> "$GITHUB_ENV"
        if: contains(matrix.NAME, 'Firefox ESR (new)')

      - name: Install Firefox ESR
        run: |
          wget --no-verbose "$FIREFOX_SOURCE_URL" -O - | tar -Jx -C "$HOME"
          echo "PATH=${HOME}/firefox:$PATH" >> "$GITHUB_ENV"
          echo "FIREFOX_BIN=${HOME}/firefox/firefox" >> "$GITHUB_ENV"
        if: contains(matrix.NAME, 'Firefox ESR')

      - name: Install dependencies
        run: npm ci

      - name: Run tests
        run: npm run ${{ matrix.NPM_SCRIPT }}

  ie:
    runs-on: windows-latest
    name: test:ie - IE
    steps:
      - name: Checkout
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

      - name: Use Node.js ${{ env.NODE_VERSION }}
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
        with:
          node-version: ${{ env.NODE_VERSION }}
          cache: npm
          cache-dependency-path: '**/package-lock.json'

      - name: Install dependencies
        run: npm ci

      - name: Run tests in Edge in IE mode
        run: npm run test:ie

  safari:
    runs-on: macos-latest
    name: test:safari - Safari
    steps:
      - name: Checkout
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

      - name: Use Node.js ${{ env.NODE_VERSION }}
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
        with:
          node-version: ${{ env.NODE_VERSION }}
          cache: npm
          cache-dependency-path: '**/package-lock.json'

      - name: Install dependencies
        run: npm ci

      - name: Run tests
        run: npm run test:safari

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: Browser Tests
 
on:
  pull_request:
  push:
    branches-ignore: "dependabot/**"
 
permissions:
  contents: read # to fetch code (actions/checkout)
 
env:
  NODE_VERSION: 24.x
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build-and-test:
    timeout-minutes: 30
    runs-on: latchkey-small
    name: ${{ matrix.NPM_SCRIPT }} - ${{ matrix.NAME }}
    strategy:
      fail-fast: false
      matrix:
        NAME: ["Chrome"]
        NPM_SCRIPT: ["test:slim", "test:no-deprecated", "test:selector-native", "test:esm"]
        include:
          - NAME: "Chrome/Firefox"
            NPM_SCRIPT: "test:browser"
          - NAME: "Firefox ESR (new)"
            NPM_SCRIPT: "test:firefox"
          - NAME: "Firefox ESR (old)"
            NPM_SCRIPT: "test:firefox"
    steps:
      - name: Checkout
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
 
      - name: Use Node.js ${{ env.NODE_VERSION }}
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
        with:
          node-version: ${{ env.NODE_VERSION }}
          cache: npm
          cache-dependency-path: '**/package-lock.json'
 
      - name: Set download URL for Firefox ESR (old)
        run: |
          echo "FIREFOX_SOURCE_URL=https://download.mozilla.org/?product=firefox-esr-latest-ssl&lang=en-US&os=linux64" >> "$GITHUB_ENV"
        if: contains(matrix.NAME, 'Firefox ESR (old)')
 
      - name: Set download URL for Firefox ESR (new)
        run: |
          echo "FIREFOX_SOURCE_URL=https://download.mozilla.org/?product=firefox-esr-next-latest-ssl&lang=en-US&os=linux64" >> "$GITHUB_ENV"
        if: contains(matrix.NAME, 'Firefox ESR (new)')
 
      - name: Install Firefox ESR
        run: |
          wget --no-verbose "$FIREFOX_SOURCE_URL" -O - | tar -Jx -C "$HOME"
          echo "PATH=${HOME}/firefox:$PATH" >> "$GITHUB_ENV"
          echo "FIREFOX_BIN=${HOME}/firefox/firefox" >> "$GITHUB_ENV"
        if: contains(matrix.NAME, 'Firefox ESR')
 
      - name: Install dependencies
        run: npm ci
 
      - name: Run tests
        run: npm run ${{ matrix.NPM_SCRIPT }}
 
  ie:
    timeout-minutes: 30
    runs-on: windows-latest
    name: test:ie - IE
    steps:
      - name: Checkout
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
 
      - name: Use Node.js ${{ env.NODE_VERSION }}
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
        with:
          node-version: ${{ env.NODE_VERSION }}
          cache: npm
          cache-dependency-path: '**/package-lock.json'
 
      - name: Install dependencies
        run: npm ci
 
      - name: Run tests in Edge in IE mode
        run: npm run test:ie
 
  safari:
    timeout-minutes: 30
    runs-on: macos-latest
    name: test:safari - Safari
    steps:
      - name: Checkout
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
 
      - name: Use Node.js ${{ env.NODE_VERSION }}
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
        with:
          node-version: ${{ env.NODE_VERSION }}
          cache: npm
          cache-dependency-path: '**/package-lock.json'
 
      - name: Install dependencies
        run: npm ci
 
      - name: Run tests
        run: npm run test:safari
 

What changed

What Latchkey heals here

This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:

This workflow runs 3 jobs (6 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow