Skip to content

Switch from npm to pnpm #5373

Switch from npm to pnpm

Switch from npm to pnpm #5373

Workflow file for this run

name: Run tests
on:
pull_request:
push:
schedule:
- cron: '3 22 * * SUN'
permissions: {}
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
version: [22, 24]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ matrix.version }}
package-manager-cache: false
- name: Setup mise
uses: jdx/mise-action@7e36c90d9ab29c415a2384db3006f3ec8a8cc654 # v4.2.4
with:
install: false
# Install pnpm only, and put just its directory on PATH. A full mise
# install would also install mise's own node (node = "latest") and could
# place it ahead of the matrix node selected above, silently testing the
# wrong version.
- name: Install pnpm
env:
MISE_AUTO_INSTALL: 'false'
run: |
mise install github:pnpm/pnpm
dirname "$(mise which pnpm)" >> "$GITHUB_PATH"
# Guard against the failure above: assert, so a shadowed node fails the
# job rather than only showing up in the log.
- name: Verify the matrix node is active
env:
EXPECTED_MAJOR: ${{ matrix.version }}
run: |
actual=$(node -p 'process.versions.node.split(".")[0]')
echo "node major: $actual (expected $EXPECTED_MAJOR)"
test "$actual" = "$EXPECTED_MAJOR"
- run: pnpm install --frozen-lockfile
- run: pnpm run test:coverage
- run: pnpm run build
- run: pnpm run build:docs
# e2e/js and e2e/ts are workspace members that depend on the library with
# workspace:*, so the root install already symlinked it into their
# node_modules. They read the dist/ built by `pnpm run build`, which is
# also why these steps must stay after it.
- run: pnpm exec vitest run
working-directory: e2e/js
- run: pnpm exec vitest run
working-directory: e2e/ts
# vitest transpiles without type-checking, so without this the TypeScript
# consumer smoke test cannot catch a type-resolution break.
- run: pnpm exec tsc --noEmit
working-directory: e2e/ts