Skip to content

Commit

Permalink
test: refactor pipelines (#861)
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub authored Jun 25, 2024
1 parent a262a21 commit 1fed69b
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 51 deletions.
43 changes: 0 additions & 43 deletions .github/workflows/check.yml

This file was deleted.

49 changes: 46 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Use Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 22.x

- run: npm ci
- run: |
npm run build
Expand All @@ -23,6 +25,39 @@ jobs:
package.json
retention-days: 1

checks:
needs: build
runs-on: ubuntu-latest
env:
FORCE_COLOR: 3
steps:
- uses: actions/checkout@v4

- name: Use Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 22.x

- uses: actions/download-artifact@v4
with:
name: build
- run: npm ci

- name: Format
run: npm run fmt:check

- name: License
run: npm run test:license

- name: Size
run: npm run test:size

- name: Dep audit
run: npm run test:audit

- name: Circular
run: npm run test:circular

test:
needs: build
runs-on: ubuntu-latest
Expand All @@ -33,18 +68,24 @@ jobs:
node-version: [16.x, 20.x, 22.x]
steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- uses: actions/download-artifact@v4
with:
name: build
- run: npm ci
- name: run all tests

- name: Unit & types tests
if: matrix.node-version == '20.x'
run: npm run test
- name: run unit tests
run: |
npm run test:coverage
npm run test:types
- name: Unit tests
if: matrix.node-version != '20.x'
run: npm run test:unit
timeout-minutes: 1
Expand All @@ -58,9 +99,11 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 16.x

- uses: actions/download-artifact@v4
with:
name: build

- run: npm run test:smoke:win32
timeout-minutes: 1
env:
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,17 @@
"fmt": "prettier --write .",
"fmt:check": "prettier --check .",
"build": "npm run build:js && npm run build:dts",
"build:check": "tsc",
"build:js": "node scripts/build-js.mjs --format=cjs --hybrid --entry=src/*.ts && npm run build:vendor",
"build:vendor": "node scripts/build-js.mjs --format=cjs --entry=src/vendor-*.ts --bundle=all",
"build:dts": "tsc --project tsconfig.prod.json && node scripts/build-dts.mjs",
"pretest": "npm run build",
"test": "npm run test:size && npm run test:unit && npm run test:types && npm run test:license",
"test": "npm run test:size && npm run fmt:check && npm run test:unit && npm run test:types && npm run test:license",
"test:unit": "node ./test/all.test.js",
"test:coverage": "c8 -x build/deno.js -x build/vendor-extra.cjs -x build/vendor-core.cjs -x build/esblib.cjs -x 'test/**' -x scripts --check-coverage npm run test:unit",
"test:circular": "madge --circular src/*",
"test:types": "tsd",
"test:license": "node ./test/extra.test.js",
"test:audit": "npm audit fix",
"test:size": "size-limit",
"test:smoke:tsx": "tsx test/smoke/ts.test.ts",
"test:smoke:tsc": "cd test/smoke && mkdir -p node_modules && ln -s ../../../ ./node_modules/zx; tsc --esModuleInterop --module node16 --rootDir . --outdir ./temp ts.test.ts && node ./temp/ts.test.js",
Expand All @@ -82,7 +83,6 @@
"test:smoke:cjs": "node ./test/smoke/node.test.cjs",
"test:smoke:mjs": "node ./test/smoke/node.test.mjs",
"test:smoke:deno": "deno test ./test/smoke/deno.test.js --allow-read --allow-sys --allow-env --allow-run",
"coverage": "c8 -x build/deno.js -x build/vendor-extra.cjs -x build/vendor-core.cjs -x build/esblib.cjs -x 'test/**' -x scripts --check-coverage npm test",
"version": "cat package.json | fx .version"
},
"optionalDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions src/vendor-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

export { exec, buildCmd, type TSpawnStore } from 'zurk/spawn'

export type RequestInfo = Parameters<typeof fetch>[0]
export type RequestInit = Parameters<typeof fetch>[1]
export type RequestInfo = Parameters<typeof globalThis.fetch>[0]
export type RequestInit = Parameters<typeof globalThis.fetch>[1]

export { default as chalk, type ChalkInstance } from 'chalk'
export { default as which } from 'which'
Expand Down

0 comments on commit 1fed69b

Please sign in to comment.