Skip to content

ci: stop known-failing suites from marking commits red #111

ci: stop known-failing suites from marking commits red

ci: stop known-failing suites from marking commits red #111

Workflow file for this run

name: Test
on:
push:
workflow_dispatch:
jobs:
testBrowser:
name: 'Test: Browsers'
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 24
- name: Cache node modules
id: cache-node-modules
uses: actions/cache@v6
env:
cache-name: cache-node-modules
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-modules-${{ env.cache-name }}-
${{ runner.os }}-modules-
${{ runner.os }}-
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium firefox webkit
- name: Run browser tests
run: npm run test:browser
testNode:
name: 'Test: Node.js ${{ matrix.node-version }}'
timeout-minutes: 15
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['22.x', '24.x', '26.x']
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node-version }}
- name: Cache node modules
id: cache-node-modules
uses: actions/cache@v6
env:
cache-name: cache-node-modules
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ env.cache-name }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-modules-${{ env.cache-name }}--node-${{ matrix.node-version }}-
${{ runner.os }}-modules-${{ env.cache-name }}
${{ runner.os }}-modules-
${{ runner.os }}-
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
- name: Run tests
run: npm test
testTypes:
name: 'Test: Types'
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 24
- name: Install dependencies
run: npm ci
- name: Check type compatibility
run: npm run test:types
testDeno:
name: 'Test: Deno'
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Install dependencies
run: deno install
- name: Run tests
run: npm run test:deno
testBun:
name: 'Test: Bun'
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install Dependencies
run: bun install --frozen-lockfile
- name: Run tests
run: npm run test:bun
# Known-failing environments, reported but never gating.
#
# happy-dom reports the test server's requests as cross-origin and blocks them. workerd's
# remaining failures all trace to cloudflare/workerd#6022, where its `EventTarget` dispatches
# `on<type>` handler properties itself and so fires our `on*` handlers twice.
#
# `continue-on-error` is deliberately on the *step* rather than the job. At job level it keeps
# the overall run green but the job still reports a check run with a `failure` conclusion, which
# is what puts a red X on the commit. At step level the job itself succeeds, so the commit stays
# green, and the outcome is written to the run summary to keep the result visible. Move
# `continue-on-error` up to the job (or drop it) once these are expected to pass.
testKnownFailing:
name: 'Test: ${{ matrix.suite }} (informational)'
timeout-minutes: 15
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
suite: ['happy-dom', 'workerd']
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 24
- name: Install dependencies
run: npm ci
- name: Run tests
id: tests
continue-on-error: true
run: |
# `pipefail` is not set in the default shell, so without it `tee` swallows the exit
# code and the step reports success no matter what the suite did.
set -o pipefail
npm run test:${{ matrix.suite }} 2>&1 | tee /tmp/${{ matrix.suite }}.log
- name: Summarise
if: always()
run: |
# Vitest forces colour on in CI, so the escape sequences have to come off before
# anything can be matched at the start of a line.
sed -E 's/\x1b\[[0-9;]*[mGKH]//g' '/tmp/${{ matrix.suite }}.log' > /tmp/plain.log
{
if [ '${{ steps.tests.outcome }}' = 'success' ]; then
echo '### ${{ matrix.suite }}: passing 🎉'
echo
echo 'This environment is no longer failing. It can be promoted to a gating job.'
else
echo '### ${{ matrix.suite }}: failing, as expected'
echo
echo '```'
grep -E '^ +(Tests|Test Files) ' /tmp/plain.log || true
echo '```'
echo
grep -E '^ FAIL ' /tmp/plain.log | sed 's/^ FAIL /- /' || true
fi
} | tee -a "$GITHUB_STEP_SUMMARY"