Skip to content

Commit d5f0bcf

Browse files
killaguclaude
andcommitted
fix: resolve CI failures
- Cast AbortSignal.any() to bypass TypeScript type check on older targets that don't include the type definition - Fix Bun CI vitest path: use node_modules/vitest/vitest.mjs instead of shell wrapper script that Bun can't parse - Fix formatting with oxfmt (import sorting, line width) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent cfdb5a8 commit d5f0bcf

32 files changed

Lines changed: 37 additions & 36 deletions

.github/workflows/bun.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ jobs:
5151
pnpm install -D vitest@latest vite@latest
5252
5353
- name: Run tests with Bun
54-
run: bun --bun ./node_modules/.bin/vitest run --reporter=dot
54+
run: bun --bun node_modules/vitest/vitest.mjs run --reporter=dot

src/HttpClient.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,7 @@ export class HttpClient extends EventEmitter {
443443
let requestSignal = args.signal;
444444
if (isBun) {
445445
const bunTimeoutSignal = AbortSignal.timeout(headersTimeout + bodyTimeout);
446-
requestSignal = args.signal
447-
? AbortSignal.any([bunTimeoutSignal, args.signal])
448-
: bunTimeoutSignal;
446+
requestSignal = args.signal ? (AbortSignal as any).any([bunTimeoutSignal, args.signal]) : bunTimeoutSignal;
449447
}
450448
const requestOptions: IUndiciRequestOption = {
451449
method,
@@ -821,8 +819,11 @@ export class HttpClient extends EventEmitter {
821819
err = new HttpClientRequestTimeoutError(headersTimeout || bodyTimeout, { cause: err });
822820
} else if (err.code === 'UND_ERR_CONNECT_TIMEOUT') {
823821
err = new HttpClientConnectTimeoutError(err.message, err.code, { cause: err });
824-
} else if (err.code === 'UND_ERR_SOCKET' || err.code === 'ECONNRESET'
825-
|| (isBun && (err.code === 'ConnectionClosed' || err.message?.includes('socket')))) {
822+
} else if (
823+
err.code === 'UND_ERR_SOCKET' ||
824+
err.code === 'ECONNRESET' ||
825+
(isBun && (err.code === 'ConnectionClosed' || err.message?.includes('socket')))
826+
) {
826827
// auto retry on socket error, https://github.com/node-modules/urllib/issues/454
827828
if (args.socketErrorRetry > 0 && requestContext.socketErrorRetries < args.socketErrorRetry) {
828829
requestContext.socketErrorRetries++;

test/HttpClient.connect.rejectUnauthorized.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { strict as assert } from 'node:assert';
22

33
import { describe, it, beforeAll, afterAll } from 'vite-plus/test';
44

5-
import { HttpClient } from '../src/index.js';
65
import { isBun } from '../src/HttpClient.js';
6+
import { HttpClient } from '../src/index.js';
77
import { startServer } from './fixtures/server.js';
88

99
describe('HttpClient.connect.rejectUnauthorized.test.ts', () => {

test/HttpClient.events.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { strict as assert } from 'node:assert';
22

33
import { describe, it, beforeAll, afterAll } from 'vite-plus/test';
44

5-
import { HttpClient } from '../src/index.js';
65
import { isBun } from '../src/HttpClient.js';
6+
import { HttpClient } from '../src/index.js';
77
import { startServer } from './fixtures/server.js';
88

99
describe('HttpClient.events.test.ts', () => {

test/HttpClient.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import { setTimeout as sleep } from 'node:timers/promises';
99
import selfsigned from 'selfsigned';
1010
import { describe, it, beforeAll, afterAll } from 'vite-plus/test';
1111

12-
import { HttpClient, getGlobalDispatcher } from '../src/index.js';
1312
import { isBun } from '../src/HttpClient.js';
13+
import { HttpClient, getGlobalDispatcher } from '../src/index.js';
1414
import type { RawResponseWithMeta } from '../src/index.js';
1515
import { startServer } from './fixtures/server.js';
1616
import { nodeMajorVersion } from './utils.js';

test/diagnostics_channel.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import { setTimeout as sleep } from 'node:timers/promises';
88
import selfsigned from 'selfsigned';
99
import { describe, it, beforeEach, afterEach } from 'vite-plus/test';
1010

11-
import urllib, { HttpClient } from '../src/index.js';
1211
import { isBun } from '../src/HttpClient.js';
12+
import urllib, { HttpClient } from '../src/index.js';
1313
import type { RequestDiagnosticsMessage, ResponseDiagnosticsMessage } from '../src/index.js';
1414
import symbols from '../src/symbols.js';
1515
import { startServer } from './fixtures/server.js';

test/fetch.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import { setTimeout as sleep } from 'node:timers/promises';
44

55
import { Request } from 'undici';
66
import { describe, it, beforeAll, afterAll } from 'vite-plus/test';
7-
import { isBun } from '../src/HttpClient.js';
87

98
import { fetch, FetchFactory } from '../src/fetch.js';
109
import type { FetchDiagnosticsMessage, FetchResponseDiagnosticsMessage } from '../src/fetch.js';
10+
import { isBun } from '../src/HttpClient.js';
1111
import type { RequestDiagnosticsMessage, ResponseDiagnosticsMessage } from '../src/HttpClient.js';
1212
import { startServer } from './fixtures/server.js';
1313

test/formData-with-BufferStream.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { basename } from 'node:path';
44

55
import { describe, it, beforeAll, afterAll } from 'vite-plus/test';
66

7-
import { HttpClient, WebFormData } from '../src/index.js';
87
import { isBun } from '../src/HttpClient.js';
8+
import { HttpClient, WebFormData } from '../src/index.js';
99
import { BufferStream } from './fixtures/BufferStream.js';
1010
import { startServer } from './fixtures/server.js';
1111

test/head-request-should-keepalive.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { scheduler } from 'node:timers/promises';
33

44
import { describe, it, beforeAll, afterAll } from 'vite-plus/test';
55

6-
import { HttpClient } from '../src/index.js';
76
import { isBun } from '../src/HttpClient.js';
7+
import { HttpClient } from '../src/index.js';
88
import { startServer } from './fixtures/server.js';
99

1010
describe('head-request-should-keepalive.test.ts', () => {

test/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import { parse as urlparse } from 'node:url';
44

55
import { describe, it, beforeAll, afterAll, afterEach, beforeEach } from 'vite-plus/test';
66

7+
import { isBun } from '../src/HttpClient.js';
78
import urllib, {
89
HttpClient,
910
getDefaultHttpClient,
1011
MockAgent,
1112
setGlobalDispatcher,
1213
getGlobalDispatcher,
1314
} from '../src/index.js';
14-
import { isBun } from '../src/HttpClient.js';
1515
import { startServer } from './fixtures/server.js';
1616
import { readableToBytes } from './utils.js';
1717

0 commit comments

Comments
 (0)