Skip to content

Commit

Permalink
test: use vitest@3
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Jan 18, 2025
1 parent 1fc07fe commit 9cf1736
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
[![Test coverage][codecov-image]][codecov-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]
[![Node.js Version](https://img.shields.io/node/v/urllib.svg?style=flat)](https://nodejs.org/en/download/)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://makeapullrequest.com)
![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/node-modules/urllib)

[npm-image]: https://img.shields.io/npm/v/urllib.svg?style=flat-square
[npm-url]: https://npmjs.org/package/urllib
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"@types/qs": "^6.9.7",
"@types/selfsigned": "^2.0.1",
"@types/tar-stream": "^2.2.2",
"@vitest/coverage-v8": "^2.0.0",
"@vitest/coverage-v8": "^3.0.2",
"busboy": "^1.6.0",
"cross-env": "^7.0.3",
"eslint": "8",
Expand All @@ -77,7 +77,7 @@
"tshy": "^3.0.0",
"tshy-after": "^1.0.0",
"typescript": "^5.0.4",
"vitest": "^2.0.0"
"vitest": "^3.0.2"
},
"engines": {
"node": ">= 18.19.0"
Expand Down
12 changes: 6 additions & 6 deletions test/HttpClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import selfsigned from 'selfsigned';
import { HttpClient, RawResponseWithMeta, getGlobalDispatcher } from '../src/index.js';
import { startServer } from './fixtures/server.js';

const pems = selfsigned.generate();

if (process.env.ENABLE_PERF) {
const obs = new PerformanceObserver(items => {
items.getEntries().forEach(item => {
Expand Down Expand Up @@ -118,10 +120,9 @@ describe('HttpClient.test.ts', () => {
});

it.skipIf(process.version.startsWith('v16.'))('should not exit after other side closed error', async () => {
const pem = selfsigned.generate();
const server = createSecureServer({
key: pem.private,
cert: pem.cert,
key: pems.private,
cert: pems.cert,
});

let count = 0;
Expand Down Expand Up @@ -176,10 +177,9 @@ describe('HttpClient.test.ts', () => {
});

it('should auto redirect work', async () => {
const pem = selfsigned.generate();
const server = createSecureServer({
key: pem.private,
cert: pem.cert,
key: pems.private,
cert: pems.cert,
});

let count = 0;
Expand Down
8 changes: 5 additions & 3 deletions test/options.timeout.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { describe, it, beforeAll, afterAll } from 'vitest';
import urllib, { HttpClientRequestTimeoutError, HttpClient } from '../src/index.js';
import { startServer } from './fixtures/server.js';

const pems = selfsigned.generate();

describe('options.timeout.test.ts', () => {
let close: any;
let _url: string;
Expand Down Expand Up @@ -46,10 +48,10 @@ describe('options.timeout.test.ts', () => {
rejectUnauthorized: false,
},
});
const pem = selfsigned.generate();

const server = createSecureServer({
key: pem.private,
cert: pem.cert,
key: pems.private,
cert: pems.cert,
});

server.on('stream', () => {
Expand Down

0 comments on commit 9cf1736

Please sign in to comment.