Skip to content
Latchkey

NPM Test workflow (yeoman/yo)

The NPM Test workflow from yeoman/yo, explained and optimized by Latchkey.

D

CI health: D - needs work

Run this on Latchkey for self-healing, caching, and up to 58% lower cost.

Grade your own workflow free or run it on Latchkey →
Source: yeoman/yo.github/workflows/ci.ymlLicense BSD-2-ClauseView source

What it does

This is the NPM Test workflow from the yeoman/yo repository, a real project running GitHub Actions. It is shown here with attribution under its BSD-2-Clause license.

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

The workflow

workflow (.yml)
name: NPM Test

env:
  FORCE_COLOR: 1

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

permissions:
  contents: read

jobs:
  build:

    runs-on: ${{ matrix.os }}

    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
        node-version: [20.x, 22.x, 24.x]

    steps:
    - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
    - uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e # v2.1.4
      with:
        node-version: ${{ matrix.node-version }}
    - run: npm ci
    - run: npm test

The same workflow, on Latchkey

Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.

name: NPM Test
 
env:
  FORCE_COLOR: 1
 
on:
  push:
    branches-ignore:
      - 'dependabot/**'
  pull_request:
    branches:
      - '*'
 
permissions:
  contents: read
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build:
    timeout-minutes: 30
 
    runs-on: ${{ matrix.os }}
 
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
        node-version: [20.x, 22.x, 24.x]
 
    steps:
    - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
    - uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e # v2.1.4
      with:
        cache: 'npm'
        node-version: ${{ matrix.node-version }}
    - run: npm ci
    - run: npm test
 

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 1 job (9 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