Skip to content

Commit

Permalink
test: use vitest beta (#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 authored Dec 3, 2023
1 parent af42161 commit c4ecac6
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 32 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ on:
pull_request:
branches: [ master ]

workflow_dispatch: {}

jobs:
Job:
name: Node.js
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
with:
os: 'ubuntu-latest, macos-latest, windows-latest'
version: '14.19.3, 14, 16, 18, 20'
install: 'npx npminstall'
2 changes: 0 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@ jobs:
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
with:
checkTest: false
58 changes: 30 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,6 @@
],
"author": "fengmk2 <fengmk2@gmail.com> (https://github.com/fengmk2)",
"homepage": "https://github.com/node-modules/urllib",
"type": "module",
"tshy": {
"exports": {
".": "./src/index.ts",
"./package.json": "./package.json"
}
},
"exports": {
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/commonjs/index.d.ts",
"default": "./dist/commonjs/index.js"
}
},
"./package.json": "./package.json"
},
"files": [
"dist",
"src"
],
"repository": {
"type": "git",
"url": "git://github.com/node-modules/urllib.git"
Expand All @@ -62,6 +38,7 @@
"test": "npm run lint && vitest run",
"test-keepalive": "cross-env TEST_KEEPALIVE_COUNT=50 vitest run --test-timeout 180000 keep-alive-header.test.ts",
"cov": "vitest run --coverage",
"preci": "node scripts/pre_test.js",
"ci": "npm run lint && npm run cov && node scripts/build_test.js",
"contributor": "git-contributor",
"clean": "rm -rf dist",
Expand Down Expand Up @@ -91,7 +68,7 @@
"@types/qs": "^6.9.7",
"@types/selfsigned": "^2.0.1",
"@types/tar-stream": "^2.2.2",
"@vitest/coverage-v8": "^0.32.0",
"@vitest/coverage-v8": "beta",
"busboy": "^1.6.0",
"cross-env": "^7.0.3",
"eslint": "^8.25.0",
Expand All @@ -101,14 +78,39 @@
"proxy": "^1.0.2",
"selfsigned": "^2.0.1",
"tar-stream": "^2.2.0",
"tshy": "^1.0.0-3",
"tshy": "^1.0.0",
"tshy-after": "^1.0.0",
"typescript": "^5.0.4",
"vitest": "^0.32.0"
"vitest": "beta"
},
"engines": {
"node": ">= 14.19.3"
},
"license": "MIT",
"types": "./dist/commonjs/index.d.ts"
"type": "module",
"tshy": {
"exports": {
".": "./src/index.ts",
"./package.json": "./package.json"
}
},
"exports": {
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/commonjs/index.d.ts",
"default": "./dist/commonjs/index.js"
}
},
"./package.json": "./package.json"
},
"files": [
"dist",
"src"
],
"types": "./dist/commonjs/index.d.ts",
"main": "./dist/commonjs/index.js"
}
15 changes: 15 additions & 0 deletions scripts/pre_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { execSync } from 'child_process';

function main() {
if (!process.version.startsWith('v14.')) {
return;
}
console.log(`use vitest@^0.32.0 on Node.js ${process.version}`);
const cwd = process.cwd()
execSync('npm i vitest@^0.32.0 @vitest/coverage-v8@^0.32.0', {
cwd,
stdio: [ 'inherit', 'inherit', 'inherit' ],
});
}

main();
5 changes: 5 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,10 @@ export default defineConfig({
'test/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
],
testTimeout: 60000,
coverage: {
include: [
'src',
],
},
},
});

0 comments on commit c4ecac6

Please sign in to comment.