Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 44 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# For more information see: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow

name: CI
name: Quality Assurance

on:
push:
Expand Down Expand Up @@ -30,7 +30,7 @@ permissions:

jobs:
get-matrix:
name: Configure Node LTS environment matrix
name: Configure Node environment matrix
runs-on: ubuntu-latest

outputs:
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
with:
persist-credentials: false
show-progress: false
- name: Set up Node.js LTS
- name: Set up Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
cache: "npm"
Expand All @@ -92,8 +92,42 @@ jobs:
- name: Validate YAML files
run: yamllint -c .yamllint.yaml -f github ./

tests:
name: Unit, e2e, coverage
test:
name: Codemod JSSG tests

if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}

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

strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest

steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
with:
egress-policy: audit

- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
show-progress: false
- name: Set up Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
cache: "npm"
check-latest: true
node-version-file: ".nvmrc"
- run: npm ci
- run: node --run test

legacy-tests:
name: Run legacy tests

if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}

Expand Down Expand Up @@ -126,10 +160,8 @@ jobs:
check-latest: true
node-version: ${{ matrix.node-version }}
- run: npm ci
- name: Run recipe tests
run: >-
node
--run test
--test-coverage-lines=0.8
--test-reporter-destination=./coverage.lcov
--test-reporter=lcov
# Codemod has changed its paradigm, but there is still a recipe that uses the old one, which is why we run it alongside it.
# The old paradigm used node to run codemod, which is why we run it on several versions.
# REF: https://codemod.com/blog/new-codemod-cli
- name: Run legacy recipe tests
run: node --run test-legacy
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"lint:fix": "biome lint --fix ./",
"lint": "biome lint ./",
"pre-commit": "node --run lint:fix; node --run type-check; node --run test",
"test": "npm run test --workspaces",
"test": "npm run test --workspaces --if-present",
"test-legacy": "npm run test-legacy --workspaces --if-present",
"type-check": "tsc"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion recipes/correct-ts-specifiers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"scripts": {
"start": "node --no-warnings --experimental-import-meta-resolve --experimental-strip-types ./src/workflow.ts",
"test": "node --no-warnings --experimental-import-meta-resolve --experimental-test-module-mocks --experimental-test-snapshots --experimental-strip-types --import='@nodejs/codemod-utils/snapshots' --test --experimental-test-coverage --test-coverage-include='src/**/*' --test-coverage-exclude='**/*.test.ts' './**/*.test.ts'"
"test-legacy": "node --no-warnings --experimental-import-meta-resolve --experimental-test-module-mocks --experimental-test-snapshots --experimental-strip-types --import='@nodejs/codemod-utils/snapshots' --test --experimental-test-coverage --test-coverage-include='src/**/*' --test-coverage-exclude='**/*.test.ts' './**/*.test.ts'"
},
"repository": {
"type": "git",
Expand Down
Loading