@types/node 22.5.5 → 22.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- node/README.md +1 -1
- node/inspector.d.ts +203 -0
- node/package.json +2 -2
- node/stream.d.ts +19 -0
- node/test.d.ts +84 -1
node/README.md
CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
9
9
|
|
10
10
|
### Additional Details
|
11
|
-
* Last updated:
|
11
|
+
* Last updated: Mon, 23 Sep 2024 21:07:32 GMT
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
13
13
|
|
14
14
|
# Credits
|
node/inspector.d.ts
CHANGED
@@ -1703,6 +1703,65 @@ declare module 'inspector' {
|
|
1703
1703
|
message: string;
|
1704
1704
|
}
|
1705
1705
|
}
|
1706
|
+
namespace Network {
|
1707
|
+
/**
|
1708
|
+
* Unique request identifier.
|
1709
|
+
*/
|
1710
|
+
type RequestId = string;
|
1711
|
+
/**
|
1712
|
+
* UTC time in seconds, counted from January 1, 1970.
|
1713
|
+
*/
|
1714
|
+
type TimeSinceEpoch = number;
|
1715
|
+
/**
|
1716
|
+
* Monotonically increasing time in seconds since an arbitrary point in the past.
|
1717
|
+
*/
|
1718
|
+
type MonotonicTime = number;
|
1719
|
+
/**
|
1720
|
+
* HTTP request data.
|
1721
|
+
*/
|
1722
|
+
interface Request {
|
1723
|
+
url: string;
|
1724
|
+
method: string;
|
1725
|
+
}
|
1726
|
+
interface RequestWillBeSentEventDataType {
|
1727
|
+
/**
|
1728
|
+
* Request identifier.
|
1729
|
+
*/
|
1730
|
+
requestId: RequestId;
|
1731
|
+
/**
|
1732
|
+
* Request data.
|
1733
|
+
*/
|
1734
|
+
request: Request;
|
1735
|
+
/**
|
1736
|
+
* Timestamp.
|
1737
|
+
*/
|
1738
|
+
timestamp: MonotonicTime;
|
1739
|
+
/**
|
1740
|
+
* Timestamp.
|
1741
|
+
*/
|
1742
|
+
wallTime: TimeSinceEpoch;
|
1743
|
+
}
|
1744
|
+
interface ResponseReceivedEventDataType {
|
1745
|
+
/**
|
1746
|
+
* Request identifier.
|
1747
|
+
*/
|
1748
|
+
requestId: RequestId;
|
1749
|
+
/**
|
1750
|
+
* Timestamp.
|
1751
|
+
*/
|
1752
|
+
timestamp: MonotonicTime;
|
1753
|
+
}
|
1754
|
+
interface LoadingFinishedEventDataType {
|
1755
|
+
/**
|
1756
|
+
* Request identifier.
|
1757
|
+
*/
|
1758
|
+
requestId: RequestId;
|
1759
|
+
/**
|
1760
|
+
* Timestamp.
|
1761
|
+
*/
|
1762
|
+
timestamp: MonotonicTime;
|
1763
|
+
}
|
1764
|
+
}
|
1706
1765
|
namespace NodeRuntime {
|
1707
1766
|
interface NotifyWhenWaitingForDisconnectParameterType {
|
1708
1767
|
enabled: boolean;
|
@@ -2076,6 +2135,14 @@ declare module 'inspector' {
|
|
2076
2135
|
*/
|
2077
2136
|
post(method: 'NodeWorker.detach', params?: NodeWorker.DetachParameterType, callback?: (err: Error | null) => void): void;
|
2078
2137
|
post(method: 'NodeWorker.detach', callback?: (err: Error | null) => void): void;
|
2138
|
+
/**
|
2139
|
+
* Disables network tracking, prevents network events from being sent to the client.
|
2140
|
+
*/
|
2141
|
+
post(method: 'Network.disable', callback?: (err: Error | null) => void): void;
|
2142
|
+
/**
|
2143
|
+
* Enables network tracking, network events will now be delivered to the client.
|
2144
|
+
*/
|
2145
|
+
post(method: 'Network.enable', callback?: (err: Error | null) => void): void;
|
2079
2146
|
/**
|
2080
2147
|
* Enable the NodeRuntime events except by `NodeRuntime.waitingForDisconnect`.
|
2081
2148
|
*/
|
@@ -2185,6 +2252,15 @@ declare module 'inspector' {
|
|
2185
2252
|
* (session ID is provided in attachedToWorker notification).
|
2186
2253
|
*/
|
2187
2254
|
addListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
|
2255
|
+
/**
|
2256
|
+
* Fired when page is about to send HTTP request.
|
2257
|
+
*/
|
2258
|
+
addListener(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification<Network.RequestWillBeSentEventDataType>) => void): this;
|
2259
|
+
/**
|
2260
|
+
* Fired when HTTP response is available.
|
2261
|
+
*/
|
2262
|
+
addListener(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
|
2263
|
+
addListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
|
2188
2264
|
/**
|
2189
2265
|
* This event is fired instead of `Runtime.executionContextDestroyed` when
|
2190
2266
|
* enabled.
|
@@ -2224,6 +2300,9 @@ declare module 'inspector' {
|
|
2224
2300
|
emit(event: 'NodeWorker.attachedToWorker', message: InspectorNotification<NodeWorker.AttachedToWorkerEventDataType>): boolean;
|
2225
2301
|
emit(event: 'NodeWorker.detachedFromWorker', message: InspectorNotification<NodeWorker.DetachedFromWorkerEventDataType>): boolean;
|
2226
2302
|
emit(event: 'NodeWorker.receivedMessageFromWorker', message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>): boolean;
|
2303
|
+
emit(event: 'Network.requestWillBeSent', message: InspectorNotification<Network.RequestWillBeSentEventDataType>): boolean;
|
2304
|
+
emit(event: 'Network.responseReceived', message: InspectorNotification<Network.ResponseReceivedEventDataType>): boolean;
|
2305
|
+
emit(event: 'Network.loadingFinished', message: InspectorNotification<Network.LoadingFinishedEventDataType>): boolean;
|
2227
2306
|
emit(event: 'NodeRuntime.waitingForDisconnect'): boolean;
|
2228
2307
|
emit(event: 'NodeRuntime.waitingForDebugger'): boolean;
|
2229
2308
|
on(event: string, listener: (...args: any[]) => void): this;
|
@@ -2321,6 +2400,15 @@ declare module 'inspector' {
|
|
2321
2400
|
* (session ID is provided in attachedToWorker notification).
|
2322
2401
|
*/
|
2323
2402
|
on(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
|
2403
|
+
/**
|
2404
|
+
* Fired when page is about to send HTTP request.
|
2405
|
+
*/
|
2406
|
+
on(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification<Network.RequestWillBeSentEventDataType>) => void): this;
|
2407
|
+
/**
|
2408
|
+
* Fired when HTTP response is available.
|
2409
|
+
*/
|
2410
|
+
on(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
|
2411
|
+
on(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
|
2324
2412
|
/**
|
2325
2413
|
* This event is fired instead of `Runtime.executionContextDestroyed` when
|
2326
2414
|
* enabled.
|
@@ -2428,6 +2516,15 @@ declare module 'inspector' {
|
|
2428
2516
|
* (session ID is provided in attachedToWorker notification).
|
2429
2517
|
*/
|
2430
2518
|
once(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
|
2519
|
+
/**
|
2520
|
+
* Fired when page is about to send HTTP request.
|
2521
|
+
*/
|
2522
|
+
once(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification<Network.RequestWillBeSentEventDataType>) => void): this;
|
2523
|
+
/**
|
2524
|
+
* Fired when HTTP response is available.
|
2525
|
+
*/
|
2526
|
+
once(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
|
2527
|
+
once(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
|
2431
2528
|
/**
|
2432
2529
|
* This event is fired instead of `Runtime.executionContextDestroyed` when
|
2433
2530
|
* enabled.
|
@@ -2535,6 +2632,15 @@ declare module 'inspector' {
|
|
2535
2632
|
* (session ID is provided in attachedToWorker notification).
|
2536
2633
|
*/
|
2537
2634
|
prependListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
|
2635
|
+
/**
|
2636
|
+
* Fired when page is about to send HTTP request.
|
2637
|
+
*/
|
2638
|
+
prependListener(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification<Network.RequestWillBeSentEventDataType>) => void): this;
|
2639
|
+
/**
|
2640
|
+
* Fired when HTTP response is available.
|
2641
|
+
*/
|
2642
|
+
prependListener(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
|
2643
|
+
prependListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
|
2538
2644
|
/**
|
2539
2645
|
* This event is fired instead of `Runtime.executionContextDestroyed` when
|
2540
2646
|
* enabled.
|
@@ -2642,6 +2748,15 @@ declare module 'inspector' {
|
|
2642
2748
|
* (session ID is provided in attachedToWorker notification).
|
2643
2749
|
*/
|
2644
2750
|
prependOnceListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
|
2751
|
+
/**
|
2752
|
+
* Fired when page is about to send HTTP request.
|
2753
|
+
*/
|
2754
|
+
prependOnceListener(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification<Network.RequestWillBeSentEventDataType>) => void): this;
|
2755
|
+
/**
|
2756
|
+
* Fired when HTTP response is available.
|
2757
|
+
*/
|
2758
|
+
prependOnceListener(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
|
2759
|
+
prependOnceListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
|
2645
2760
|
/**
|
2646
2761
|
* This event is fired instead of `Runtime.executionContextDestroyed` when
|
2647
2762
|
* enabled.
|
@@ -2737,6 +2852,36 @@ declare module 'inspector' {
|
|
2737
2852
|
* @since v11.0.0
|
2738
2853
|
*/
|
2739
2854
|
const console: InspectorConsole;
|
2855
|
+
|
2856
|
+
namespace Network {
|
2857
|
+
/**
|
2858
|
+
* This feature is only available with the `--experimental-network-inspection` flag enabled.
|
2859
|
+
*
|
2860
|
+
* Broadcasts the `Network.requestWillBeSent` event to connected frontends. This event indicates that
|
2861
|
+
* the application is about to send an HTTP request.
|
2862
|
+
* @since v22.6.0
|
2863
|
+
* @experimental
|
2864
|
+
*/
|
2865
|
+
function requestWillBeSent(params: RequestWillBeSentEventDataType): void;
|
2866
|
+
/**
|
2867
|
+
* This feature is only available with the `--experimental-network-inspection` flag enabled.
|
2868
|
+
*
|
2869
|
+
* Broadcasts the `Network.responseReceived` event to connected frontends. This event indicates that
|
2870
|
+
* HTTP response is available.
|
2871
|
+
* @since v22.6.0
|
2872
|
+
* @experimental
|
2873
|
+
*/
|
2874
|
+
function responseReceived(params: ResponseReceivedEventDataType): void;
|
2875
|
+
/**
|
2876
|
+
* This feature is only available with the `--experimental-network-inspection` flag enabled.
|
2877
|
+
*
|
2878
|
+
* Broadcasts the `Network.loadingFinished` event to connected frontends. This event indicates that
|
2879
|
+
* HTTP request has finished loading.
|
2880
|
+
* @since v22.6.0
|
2881
|
+
* @experimental
|
2882
|
+
*/
|
2883
|
+
function loadingFinished(params: LoadingFinishedEventDataType): void;
|
2884
|
+
}
|
2740
2885
|
}
|
2741
2886
|
|
2742
2887
|
/**
|
@@ -2770,6 +2915,7 @@ declare module 'inspector/promises' {
|
|
2770
2915
|
HeapProfiler,
|
2771
2916
|
NodeTracing,
|
2772
2917
|
NodeWorker,
|
2918
|
+
Network,
|
2773
2919
|
NodeRuntime,
|
2774
2920
|
} from 'inspector';
|
2775
2921
|
|
@@ -3087,6 +3233,14 @@ declare module 'inspector/promises' {
|
|
3087
3233
|
* Detached from the worker with given sessionId.
|
3088
3234
|
*/
|
3089
3235
|
post(method: 'NodeWorker.detach', params?: NodeWorker.DetachParameterType): Promise<void>;
|
3236
|
+
/**
|
3237
|
+
* Disables network tracking, prevents network events from being sent to the client.
|
3238
|
+
*/
|
3239
|
+
post(method: 'Network.disable'): Promise<void>;
|
3240
|
+
/**
|
3241
|
+
* Enables network tracking, network events will now be delivered to the client.
|
3242
|
+
*/
|
3243
|
+
post(method: 'Network.enable'): Promise<void>;
|
3090
3244
|
/**
|
3091
3245
|
* Enable the NodeRuntime events except by `NodeRuntime.waitingForDisconnect`.
|
3092
3246
|
*/
|
@@ -3195,6 +3349,15 @@ declare module 'inspector/promises' {
|
|
3195
3349
|
* (session ID is provided in attachedToWorker notification).
|
3196
3350
|
*/
|
3197
3351
|
addListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
|
3352
|
+
/**
|
3353
|
+
* Fired when page is about to send HTTP request.
|
3354
|
+
*/
|
3355
|
+
addListener(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification<Network.RequestWillBeSentEventDataType>) => void): this;
|
3356
|
+
/**
|
3357
|
+
* Fired when HTTP response is available.
|
3358
|
+
*/
|
3359
|
+
addListener(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
|
3360
|
+
addListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
|
3198
3361
|
/**
|
3199
3362
|
* This event is fired instead of `Runtime.executionContextDestroyed` when
|
3200
3363
|
* enabled.
|
@@ -3234,6 +3397,9 @@ declare module 'inspector/promises' {
|
|
3234
3397
|
emit(event: 'NodeWorker.attachedToWorker', message: InspectorNotification<NodeWorker.AttachedToWorkerEventDataType>): boolean;
|
3235
3398
|
emit(event: 'NodeWorker.detachedFromWorker', message: InspectorNotification<NodeWorker.DetachedFromWorkerEventDataType>): boolean;
|
3236
3399
|
emit(event: 'NodeWorker.receivedMessageFromWorker', message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>): boolean;
|
3400
|
+
emit(event: 'Network.requestWillBeSent', message: InspectorNotification<Network.RequestWillBeSentEventDataType>): boolean;
|
3401
|
+
emit(event: 'Network.responseReceived', message: InspectorNotification<Network.ResponseReceivedEventDataType>): boolean;
|
3402
|
+
emit(event: 'Network.loadingFinished', message: InspectorNotification<Network.LoadingFinishedEventDataType>): boolean;
|
3237
3403
|
emit(event: 'NodeRuntime.waitingForDisconnect'): boolean;
|
3238
3404
|
emit(event: 'NodeRuntime.waitingForDebugger'): boolean;
|
3239
3405
|
on(event: string, listener: (...args: any[]) => void): this;
|
@@ -3331,6 +3497,15 @@ declare module 'inspector/promises' {
|
|
3331
3497
|
* (session ID is provided in attachedToWorker notification).
|
3332
3498
|
*/
|
3333
3499
|
on(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
|
3500
|
+
/**
|
3501
|
+
* Fired when page is about to send HTTP request.
|
3502
|
+
*/
|
3503
|
+
on(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification<Network.RequestWillBeSentEventDataType>) => void): this;
|
3504
|
+
/**
|
3505
|
+
* Fired when HTTP response is available.
|
3506
|
+
*/
|
3507
|
+
on(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
|
3508
|
+
on(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
|
3334
3509
|
/**
|
3335
3510
|
* This event is fired instead of `Runtime.executionContextDestroyed` when
|
3336
3511
|
* enabled.
|
@@ -3438,6 +3613,15 @@ declare module 'inspector/promises' {
|
|
3438
3613
|
* (session ID is provided in attachedToWorker notification).
|
3439
3614
|
*/
|
3440
3615
|
once(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
|
3616
|
+
/**
|
3617
|
+
* Fired when page is about to send HTTP request.
|
3618
|
+
*/
|
3619
|
+
once(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification<Network.RequestWillBeSentEventDataType>) => void): this;
|
3620
|
+
/**
|
3621
|
+
* Fired when HTTP response is available.
|
3622
|
+
*/
|
3623
|
+
once(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
|
3624
|
+
once(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
|
3441
3625
|
/**
|
3442
3626
|
* This event is fired instead of `Runtime.executionContextDestroyed` when
|
3443
3627
|
* enabled.
|
@@ -3545,6 +3729,15 @@ declare module 'inspector/promises' {
|
|
3545
3729
|
* (session ID is provided in attachedToWorker notification).
|
3546
3730
|
*/
|
3547
3731
|
prependListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
|
3732
|
+
/**
|
3733
|
+
* Fired when page is about to send HTTP request.
|
3734
|
+
*/
|
3735
|
+
prependListener(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification<Network.RequestWillBeSentEventDataType>) => void): this;
|
3736
|
+
/**
|
3737
|
+
* Fired when HTTP response is available.
|
3738
|
+
*/
|
3739
|
+
prependListener(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
|
3740
|
+
prependListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
|
3548
3741
|
/**
|
3549
3742
|
* This event is fired instead of `Runtime.executionContextDestroyed` when
|
3550
3743
|
* enabled.
|
@@ -3652,6 +3845,15 @@ declare module 'inspector/promises' {
|
|
3652
3845
|
* (session ID is provided in attachedToWorker notification).
|
3653
3846
|
*/
|
3654
3847
|
prependOnceListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
|
3848
|
+
/**
|
3849
|
+
* Fired when page is about to send HTTP request.
|
3850
|
+
*/
|
3851
|
+
prependOnceListener(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification<Network.RequestWillBeSentEventDataType>) => void): this;
|
3852
|
+
/**
|
3853
|
+
* Fired when HTTP response is available.
|
3854
|
+
*/
|
3855
|
+
prependOnceListener(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
|
3856
|
+
prependOnceListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
|
3655
3857
|
/**
|
3656
3858
|
* This event is fired instead of `Runtime.executionContextDestroyed` when
|
3657
3859
|
* enabled.
|
@@ -3682,6 +3884,7 @@ declare module 'inspector/promises' {
|
|
3682
3884
|
HeapProfiler,
|
3683
3885
|
NodeTracing,
|
3684
3886
|
NodeWorker,
|
3887
|
+
Network,
|
3685
3888
|
NodeRuntime,
|
3686
3889
|
};
|
3687
3890
|
}
|
node/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/node",
|
3
|
-
"version": "22.
|
3
|
+
"version": "22.6.1",
|
4
4
|
"description": "TypeScript definitions for node",
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
6
6
|
"license": "MIT",
|
@@ -212,6 +212,6 @@
|
|
212
212
|
"dependencies": {
|
213
213
|
"undici-types": "~6.19.2"
|
214
214
|
},
|
215
|
-
"typesPublisherContentHash": "
|
215
|
+
"typesPublisherContentHash": "1445f8e238b8d2b5072d175305ab08953ef767426c16d5ae023784aefd6098a0",
|
216
216
|
"typeScriptVersion": "4.8"
|
217
217
|
}
|
node/stream.d.ts
CHANGED
@@ -1250,6 +1250,25 @@ declare module "stream" {
|
|
1250
1250
|
removeListener(event: "unpipe", listener: (src: Readable) => void): this;
|
1251
1251
|
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
1252
1252
|
}
|
1253
|
+
/**
|
1254
|
+
* The utility function `duplexPair` returns an Array with two items,
|
1255
|
+
* each being a `Duplex` stream connected to the other side:
|
1256
|
+
*
|
1257
|
+
* ```js
|
1258
|
+
* const [ sideA, sideB ] = duplexPair();
|
1259
|
+
* ```
|
1260
|
+
*
|
1261
|
+
* Whatever is written to one stream is made readable on the other. It provides
|
1262
|
+
* behavior analogous to a network connection, where the data written by the client
|
1263
|
+
* becomes readable by the server, and vice-versa.
|
1264
|
+
*
|
1265
|
+
* The Duplex streams are symmetrical; one or the other may be used without any
|
1266
|
+
* difference in behavior.
|
1267
|
+
* @param options A value to pass to both {@link Duplex} constructors,
|
1268
|
+
* to set options such as buffering.
|
1269
|
+
* @since v22.6.0
|
1270
|
+
*/
|
1271
|
+
function duplexPair(options?: DuplexOptions): [Duplex, Duplex];
|
1253
1272
|
type TransformCallback = (error?: Error | null, data?: any) => void;
|
1254
1273
|
interface TransformOptions extends DuplexOptions {
|
1255
1274
|
construct?(this: Transform, callback: (error?: Error | null) => void): void;
|
node/test.d.ts
CHANGED
@@ -331,6 +331,13 @@ declare module "node:test" {
|
|
331
331
|
* @default false
|
332
332
|
*/
|
333
333
|
forceExit?: boolean | undefined;
|
334
|
+
/**
|
335
|
+
* An array containing the list of glob patterns to match test files.
|
336
|
+
* This option cannot be used together with `files`. If omitted, files are run according to the
|
337
|
+
* [test runner execution model](https://nodejs.org/docs/latest-v22.x/api/test.html#test-runner-execution-model).
|
338
|
+
* @since v22.6.0
|
339
|
+
*/
|
340
|
+
globPatterns?: readonly string[] | undefined;
|
334
341
|
/**
|
335
342
|
* Sets inspector port of test child process.
|
336
343
|
* If a nullish value is provided, each process gets its own port,
|
@@ -479,7 +486,7 @@ declare module "node:test" {
|
|
479
486
|
/**
|
480
487
|
* An object containing assertion methods bound to the test context.
|
481
488
|
* The top-level functions from the `node:assert` module are exposed here for the purpose of creating test plans.
|
482
|
-
* @since v22.2.0
|
489
|
+
* @since v22.2.0, v20.15.0
|
483
490
|
*/
|
484
491
|
readonly assert: TestContextAssert;
|
485
492
|
/**
|
@@ -528,6 +535,12 @@ declare module "node:test" {
|
|
528
535
|
* @param message Message to be reported.
|
529
536
|
*/
|
530
537
|
diagnostic(message: string): void;
|
538
|
+
/**
|
539
|
+
* The absolute path of the test file that created the current test. If a test file imports
|
540
|
+
* additional modules that generate tests, the imported tests will return the path of the root test file.
|
541
|
+
* @since v22.6.0
|
542
|
+
*/
|
543
|
+
readonly filePath: string | undefined;
|
531
544
|
/**
|
532
545
|
* The name of the test and each of its ancestors, separated by `>`.
|
533
546
|
* @since v22.3.0
|
@@ -657,6 +670,22 @@ declare module "node:test" {
|
|
657
670
|
deepEqual: typeof import("node:assert").deepEqual;
|
658
671
|
/**
|
659
672
|
* Identical to the `deepStrictEqual` function from the `node:assert` module, but bound to the test context.
|
673
|
+
*
|
674
|
+
* **Note:** as this method returns a type assertion, the context parameter in the callback signature must have a
|
675
|
+
* type annotation, otherwise an error will be raised by the TypeScript compiler:
|
676
|
+
* ```ts
|
677
|
+
* import { test, type TestContext } from 'node:test';
|
678
|
+
*
|
679
|
+
* // The test function's context parameter must have a type annotation.
|
680
|
+
* test('example', (t: TestContext) => {
|
681
|
+
* t.assert.deepStrictEqual(actual, expected);
|
682
|
+
* });
|
683
|
+
*
|
684
|
+
* // Omitting the type annotation will result in a compilation error.
|
685
|
+
* test('example', t => {
|
686
|
+
* t.assert.deepStrictEqual(actual, expected); // Error: 't' needs an explicit type annotation.
|
687
|
+
* });
|
688
|
+
* ```
|
660
689
|
*/
|
661
690
|
deepStrictEqual: typeof import("node:assert").deepStrictEqual;
|
662
691
|
/**
|
@@ -681,6 +710,22 @@ declare module "node:test" {
|
|
681
710
|
fail: typeof import("node:assert").fail;
|
682
711
|
/**
|
683
712
|
* Identical to the `ifError` function from the `node:assert` module, but bound to the test context.
|
713
|
+
*
|
714
|
+
* **Note:** as this method returns a type assertion, the context parameter in the callback signature must have a
|
715
|
+
* type annotation, otherwise an error will be raised by the TypeScript compiler:
|
716
|
+
* ```ts
|
717
|
+
* import { test, type TestContext } from 'node:test';
|
718
|
+
*
|
719
|
+
* // The test function's context parameter must have a type annotation.
|
720
|
+
* test('example', (t: TestContext) => {
|
721
|
+
* t.assert.ifError(err);
|
722
|
+
* });
|
723
|
+
*
|
724
|
+
* // Omitting the type annotation will result in a compilation error.
|
725
|
+
* test('example', t => {
|
726
|
+
* t.assert.ifError(err); // Error: 't' needs an explicit type annotation.
|
727
|
+
* });
|
728
|
+
* ```
|
684
729
|
*/
|
685
730
|
ifError: typeof import("node:assert").ifError;
|
686
731
|
/**
|
@@ -705,6 +750,22 @@ declare module "node:test" {
|
|
705
750
|
notStrictEqual: typeof import("node:assert").notStrictEqual;
|
706
751
|
/**
|
707
752
|
* Identical to the `ok` function from the `node:assert` module, but bound to the test context.
|
753
|
+
*
|
754
|
+
* **Note:** as this method returns a type assertion, the context parameter in the callback signature must have a
|
755
|
+
* type annotation, otherwise an error will be raised by the TypeScript compiler:
|
756
|
+
* ```ts
|
757
|
+
* import { test, type TestContext } from 'node:test';
|
758
|
+
*
|
759
|
+
* // The test function's context parameter must have a type annotation.
|
760
|
+
* test('example', (t: TestContext) => {
|
761
|
+
* t.assert.ok(condition);
|
762
|
+
* });
|
763
|
+
*
|
764
|
+
* // Omitting the type annotation will result in a compilation error.
|
765
|
+
* test('example', t => {
|
766
|
+
* t.assert.ok(condition)); // Error: 't' needs an explicit type annotation.
|
767
|
+
* });
|
768
|
+
* ```
|
708
769
|
*/
|
709
770
|
ok: typeof import("node:assert").ok;
|
710
771
|
/**
|
@@ -713,6 +774,22 @@ declare module "node:test" {
|
|
713
774
|
rejects: typeof import("node:assert").rejects;
|
714
775
|
/**
|
715
776
|
* Identical to the `strictEqual` function from the `node:assert` module, but bound to the test context.
|
777
|
+
*
|
778
|
+
* **Note:** as this method returns a type assertion, the context parameter in the callback signature must have a
|
779
|
+
* type annotation, otherwise an error will be raised by the TypeScript compiler:
|
780
|
+
* ```ts
|
781
|
+
* import { test, type TestContext } from 'node:test';
|
782
|
+
*
|
783
|
+
* // The test function's context parameter must have a type annotation.
|
784
|
+
* test('example', (t: TestContext) => {
|
785
|
+
* t.assert.strictEqual(actual, expected);
|
786
|
+
* });
|
787
|
+
*
|
788
|
+
* // Omitting the type annotation will result in a compilation error.
|
789
|
+
* test('example', t => {
|
790
|
+
* t.assert.strictEqual(actual, expected); // Error: 't' needs an explicit type annotation.
|
791
|
+
* });
|
792
|
+
* ```
|
716
793
|
*/
|
717
794
|
strictEqual: typeof import("node:assert").strictEqual;
|
718
795
|
/**
|
@@ -758,6 +835,12 @@ declare module "node:test" {
|
|
758
835
|
* @since v18.7.0, v16.17.0
|
759
836
|
*/
|
760
837
|
class SuiteContext {
|
838
|
+
/**
|
839
|
+
* The absolute path of the test file that created the current suite. If a test file imports
|
840
|
+
* additional modules that generate suites, the imported suites will return the path of the root test file.
|
841
|
+
* @since v22.6.0
|
842
|
+
*/
|
843
|
+
readonly filePath: string | undefined;
|
761
844
|
/**
|
762
845
|
* The name of the suite.
|
763
846
|
* @since v18.8.0, v16.18.0
|