@types/k6 0.53.1 → 0.54.0
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.
- k6/README.md +1 -1
- k6/{browser.d.ts → browser/index.d.ts} +37 -1
- k6/{crypto.d.ts → crypto/index.d.ts} +1 -162
- k6/encoding/index.d.ts +46 -0
- k6/execution/index.d.ts +115 -0
- k6/experimental/{browser.d.ts → browser/index.d.ts} +1 -1
- k6/experimental/csv/index.d.ts +80 -0
- k6/experimental/{fs.d.ts → fs/index.d.ts} +2 -0
- k6/experimental/{redis.d.ts → redis/index.d.ts} +5 -0
- k6/experimental/{tracing.d.ts → tracing/index.d.ts} +3 -1
- k6/experimental/{websockets.d.ts → websockets/index.d.ts} +5 -4
- k6/global.d.ts +11 -3
- k6/{http.d.ts → http/index.d.ts} +14 -227
- k6/index.d.ts +3 -22
- k6/net/grpc/index.d.ts +218 -0
- k6/{options.d.ts → options/index.d.ts} +1 -1
- k6/package.json +3 -2
- k6/{ws.d.ts → ws/index.d.ts} +2 -41
- k6/encoding.d.ts +0 -90
- k6/execution.d.ts +0 -121
- k6/net/grpc.d.ts +0 -202
- k6/timers.d.ts +0 -47
- /k6/{data.d.ts → data/index.d.ts} +0 -0
- /k6/experimental/{streams.d.ts → streams/index.d.ts} +0 -0
- /k6/experimental/{webcrypto.d.ts → webcrypto/index.d.ts} +0 -0
- /k6/{html.d.ts → html/index.d.ts} +0 -0
- /k6/{metrics.d.ts → metrics/index.d.ts} +0 -0
- /k6/{experimental/timers.d.ts → timers/index.d.ts} +0 -0
k6/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This package contains type definitions for k6 (https://grafana.com/docs/k6/lates
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/k6.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Mon, 30 Sep 2024 10:08:47 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
|
|
14
14
|
# Credits
|
|
@@ -163,6 +163,8 @@ export type ElementClickOptions = ElementHandlePointerOptions & {
|
|
|
163
163
|
position?: { x: number; y: number };
|
|
164
164
|
};
|
|
165
165
|
|
|
166
|
+
export type FrameCheckOptions = ElementClickOptions;
|
|
167
|
+
|
|
166
168
|
export interface KeyboardModifierOptions {
|
|
167
169
|
/**
|
|
168
170
|
* `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action.
|
|
@@ -1333,6 +1335,14 @@ export interface ElementHandle extends JSHandle {
|
|
|
1333
1335
|
*/
|
|
1334
1336
|
selectText(options?: ElementHandleOptions): Promise<void>;
|
|
1335
1337
|
|
|
1338
|
+
/**
|
|
1339
|
+
* Checks or unchecks the input checkbox element.
|
|
1340
|
+
* @param checked Whether to check or uncheck the element.
|
|
1341
|
+
* @param options Options to customize the check action.
|
|
1342
|
+
* @returns A promise that resolves when the element is checked or unchecked.
|
|
1343
|
+
*/
|
|
1344
|
+
setChecked(checked: boolean, options?: ElementClickOptions & StrictnessOptions): Promise<void>;
|
|
1345
|
+
|
|
1336
1346
|
/**
|
|
1337
1347
|
* Sets the file input element's value to the specified files.
|
|
1338
1348
|
*
|
|
@@ -1578,6 +1588,15 @@ export interface Frame {
|
|
|
1578
1588
|
*/
|
|
1579
1589
|
goto(url: string, options?: NavigationOptions): Promise<Response | null>;
|
|
1580
1590
|
|
|
1591
|
+
/**
|
|
1592
|
+
* Checks or unchecks the input checkbox element.
|
|
1593
|
+
* @param selector A selector to search for an element.
|
|
1594
|
+
* @param checked Whether to check or uncheck the element.
|
|
1595
|
+
* @param options Options to customize the check action.
|
|
1596
|
+
* @returns A promise that resolves when the element is checked or unchecked.
|
|
1597
|
+
*/
|
|
1598
|
+
setChecked(selector: string, checked: boolean, options?: FrameCheckOptions & StrictnessOptions): Promise<void>;
|
|
1599
|
+
|
|
1581
1600
|
/**
|
|
1582
1601
|
* Replace the entire HTML document content.
|
|
1583
1602
|
* @param html The HTML to use.
|
|
@@ -2029,6 +2048,14 @@ export interface Locator {
|
|
|
2029
2048
|
options?: ElementHandleOptions,
|
|
2030
2049
|
): Promise<string[]>;
|
|
2031
2050
|
|
|
2051
|
+
/**
|
|
2052
|
+
* Checks or unchecks the input checkbox element.
|
|
2053
|
+
* @param checked Whether to check or uncheck the element.
|
|
2054
|
+
* @param options Options to customize the check action.
|
|
2055
|
+
* @returns A promise that resolves when the element is checked or unchecked.
|
|
2056
|
+
*/
|
|
2057
|
+
setChecked(checked: boolean, options?: FrameCheckOptions): Promise<void>;
|
|
2058
|
+
|
|
2032
2059
|
/**
|
|
2033
2060
|
* Press a single key on the keyboard or a combination of keys.
|
|
2034
2061
|
* A superset of the key values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values).
|
|
@@ -3066,6 +3093,15 @@ export interface Page {
|
|
|
3066
3093
|
} & ScreenshotOptions,
|
|
3067
3094
|
): Promise<ArrayBuffer>;
|
|
3068
3095
|
|
|
3096
|
+
/**
|
|
3097
|
+
* Checks or unchecks the input checkbox element.
|
|
3098
|
+
* @param selector A selector to search for an element.
|
|
3099
|
+
* @param checked Whether to check or uncheck the element.
|
|
3100
|
+
* @param options Options to customize the check action.
|
|
3101
|
+
* @returns A promise that resolves when the element is checked or unchecked.
|
|
3102
|
+
*/
|
|
3103
|
+
setChecked(selector: string, checked: boolean, options?: FrameCheckOptions & StrictnessOptions): Promise<void>;
|
|
3104
|
+
|
|
3069
3105
|
/**
|
|
3070
3106
|
* **NOTE** Use locator-based locator.selectOption(values[, options]) instead.
|
|
3071
3107
|
*
|
|
@@ -3359,7 +3395,7 @@ export interface Page {
|
|
|
3359
3395
|
* **Usage**
|
|
3360
3396
|
*
|
|
3361
3397
|
* ```js
|
|
3362
|
-
* import { browser, networkProfiles } from 'k6/
|
|
3398
|
+
* import { browser, networkProfiles } from 'k6/browser';
|
|
3363
3399
|
* ... // redacted
|
|
3364
3400
|
* const context = browser.newContext();
|
|
3365
3401
|
* const page = context.newPage();
|
|
@@ -215,165 +215,4 @@ export abstract class Hasher {
|
|
|
215
215
|
digest<OE extends OutputEncoding>(outputEncoding: OE): Output<OE>;
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
|
|
219
|
-
* This module provides common hashing functionality available in the GoLang crypto package.
|
|
220
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/
|
|
221
|
-
*/
|
|
222
|
-
declare namespace crypto {
|
|
223
|
-
/**
|
|
224
|
-
* Generate random bytes.
|
|
225
|
-
* @param size - Number of bytes to generate.
|
|
226
|
-
* @returns An ArrayBuffer with cryptographically random bytes.
|
|
227
|
-
* @example
|
|
228
|
-
* const bytes = crypto.randomBytes(42);
|
|
229
|
-
* const view = new Uint8Array(bytes);
|
|
230
|
-
* console.log(view); // 156,71,245,191,56,...
|
|
231
|
-
*/
|
|
232
|
-
function randomBytes(size: number): ArrayBuffer;
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Produce HMAC.
|
|
236
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/hmac/
|
|
237
|
-
* @param algorithm - Hash algorithm.
|
|
238
|
-
* @param secret - Shared secret.
|
|
239
|
-
* @param input - Input data.
|
|
240
|
-
* @param outputEncoding - Output encoding.
|
|
241
|
-
* @returns Produced HMAC.
|
|
242
|
-
* @example
|
|
243
|
-
* crypto.hmac('sha256', 'mysecret', 'hello world!', 'hex')
|
|
244
|
-
*/
|
|
245
|
-
function hmac<OE extends OutputEncoding>(
|
|
246
|
-
algorithm: Algorithm,
|
|
247
|
-
secret: string | ArrayBuffer,
|
|
248
|
-
input: string | ArrayBuffer,
|
|
249
|
-
outputEncoding: OE,
|
|
250
|
-
): Output<OE>;
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Hash with MD4.
|
|
254
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/md4/
|
|
255
|
-
* @param input - Data to hash.
|
|
256
|
-
* @param outputEncoding - Output encoding.
|
|
257
|
-
* @returns MD4 digest.
|
|
258
|
-
* @example
|
|
259
|
-
* crypto.md4('hello world!', 'hex')
|
|
260
|
-
*/
|
|
261
|
-
function md4<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Hash with MD5.
|
|
265
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/md5/
|
|
266
|
-
* @param input - Data to hash.
|
|
267
|
-
* @param outputEncoding - Output encoding.
|
|
268
|
-
* @returns MD5 digest.
|
|
269
|
-
* @example
|
|
270
|
-
* crypto.md5("hello world!", "hex")
|
|
271
|
-
*/
|
|
272
|
-
function md5<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* Hash with SHA-1.
|
|
276
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/sha1/
|
|
277
|
-
* @param input - Data to hash.
|
|
278
|
-
* @param outputEncoding - Output encoding.
|
|
279
|
-
* @returns SHA-1 digest.
|
|
280
|
-
* @example
|
|
281
|
-
* crypto.sha1('hello world!', 'hex')
|
|
282
|
-
*/
|
|
283
|
-
function sha1<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Hash with SHA-256.
|
|
287
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/sha256/
|
|
288
|
-
* @param input - Data to hash.
|
|
289
|
-
* @param outputEncoding - Output encoding.
|
|
290
|
-
* @returns SHA-256 digest.
|
|
291
|
-
* @example
|
|
292
|
-
* crypto.sha256('hello world!', 'hex')
|
|
293
|
-
*/
|
|
294
|
-
function sha256<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Hash with SHA-384.
|
|
298
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/sha384/
|
|
299
|
-
* @param input - Data to hash.
|
|
300
|
-
* @param outputEncoding - Output encoding.
|
|
301
|
-
* @returns SHA-384 digest.
|
|
302
|
-
* @example
|
|
303
|
-
* crypto.sha384('hello world!', 'hex')
|
|
304
|
-
*/
|
|
305
|
-
function sha384<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* Hash with SHA-512.
|
|
309
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/sha512/
|
|
310
|
-
* @param input - Data to hash.
|
|
311
|
-
* @param outputEncoding - Output encoding.
|
|
312
|
-
* @returns SHA-512 digest.
|
|
313
|
-
* @example
|
|
314
|
-
* crypto.sha512('hello world!', 'hex')
|
|
315
|
-
*/
|
|
316
|
-
function sha512<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* Hash with SHA-512/224.
|
|
320
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/sha512_224/
|
|
321
|
-
* @param input - Data to hash.
|
|
322
|
-
* @param outputEncoding - Output encoding.
|
|
323
|
-
* @returns SHA-512/224 digest.
|
|
324
|
-
* @example
|
|
325
|
-
* crypto.sha512_224('hello world!', 'hex')
|
|
326
|
-
*/
|
|
327
|
-
function sha512_224<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* Hash with SHA-512/256.
|
|
331
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/sha512_256/
|
|
332
|
-
* @param input - Data to hash.
|
|
333
|
-
* @param outputEncoding - Output encoding.
|
|
334
|
-
* @returns SHA-512/256 digest.
|
|
335
|
-
* @example
|
|
336
|
-
* crypto.sha512_256('hello world!', 'hex')
|
|
337
|
-
*/
|
|
338
|
-
function sha512_256<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Hash with RIPEMD-160.
|
|
342
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/ripemd160/
|
|
343
|
-
* @param input - Data to hash.
|
|
344
|
-
* @param outputEncoding - Output encoding.
|
|
345
|
-
* @returns RIPEMD-160 digest.
|
|
346
|
-
* @example
|
|
347
|
-
* crypto.ripemd160('hello world!', 'hex')
|
|
348
|
-
*/
|
|
349
|
-
function ripemd160<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* Create a hashing object.
|
|
353
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/createhash/
|
|
354
|
-
* @param algorithm - Hash algorithm.
|
|
355
|
-
* @returns Hashing object.
|
|
356
|
-
* @example
|
|
357
|
-
* let hasher = crypto.createHash('sha256');
|
|
358
|
-
* hasher.update('hello ');
|
|
359
|
-
* hasher.update('world!');
|
|
360
|
-
* console.log(hasher.digest('hex'));
|
|
361
|
-
*/
|
|
362
|
-
function createHash(algorithm: Algorithm): Hasher;
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
* Create an HMAC hashing object.
|
|
366
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/createhmac/
|
|
367
|
-
* @param algorithm - Hash algorithm.
|
|
368
|
-
* @param secret - Shared secret.
|
|
369
|
-
* @returns HMAC hashing object.
|
|
370
|
-
* @example
|
|
371
|
-
* let hasher = crypto.createHMAC('sha256', 'a secret');
|
|
372
|
-
* hasher.update('hello ');
|
|
373
|
-
* hasher.update('world!');
|
|
374
|
-
* console.log(hasher.digest('hex'));
|
|
375
|
-
*/
|
|
376
|
-
function createHMAC(algorithm: Algorithm, secret: string | ArrayBuffer): Hasher;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
export default crypto;
|
|
218
|
+
export * as default from "k6/crypto";
|
k6/encoding/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base64 decode a string.
|
|
3
|
+
* https://grafana.com/docs/k6/latest/javascript-api/k6-encoding/b64decode/
|
|
4
|
+
* @param input - The string to base64 decode.
|
|
5
|
+
* @param encoding - Base64 variant.
|
|
6
|
+
* @returns The base64 decoded version of the input string in either string or ArrayBuffer format, depending on the `format` parameter.
|
|
7
|
+
* @example
|
|
8
|
+
* encoding.b64decode(str)
|
|
9
|
+
* encoding.b64decode(str, 'rawstd')
|
|
10
|
+
* const decBuffer = encoding.b64decode(str, 'rawurl')
|
|
11
|
+
* let decBin = new Uint8Array(decBuffer);
|
|
12
|
+
*/
|
|
13
|
+
export function b64decode(input: string, encoding?: Base64Variant): ArrayBuffer;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Base64 decode a string.
|
|
17
|
+
* https://grafana.com/docs/k6/latest/javascript-api/k6-encoding/b64decode/
|
|
18
|
+
* @param input - The string to base64 decode.
|
|
19
|
+
* @param encoding - Base64 variant.
|
|
20
|
+
* @param format - If 's' return the data as a string, otherwise an ArrayBuffer object .
|
|
21
|
+
* @returns The base64 decoded version of the input string in either string or ArrayBuffer format, depending on the `format` parameter.
|
|
22
|
+
* @example
|
|
23
|
+
* encoding.b64decode(str)
|
|
24
|
+
* encoding.b64decode(str, 'rawstd')
|
|
25
|
+
* const decodedString = encoding.b64decode(str, 'rawurl', 's')
|
|
26
|
+
*/
|
|
27
|
+
export function b64decode(input: string, encoding: Base64Variant, format: "s"): string;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Base64 encode a string.
|
|
31
|
+
* https://grafana.com/docs/k6/latest/javascript-api/k6-encoding/b64encode/
|
|
32
|
+
* @param input - String to encode or ArrayBuffer object.
|
|
33
|
+
* @param encoding - Base64 variant.
|
|
34
|
+
* @returns Base64 encoded string.
|
|
35
|
+
* @example
|
|
36
|
+
* encoding.b64encode(str)
|
|
37
|
+
* encoding.b64encode(str, 'rawstd')
|
|
38
|
+
*/
|
|
39
|
+
export function b64encode(input: string | ArrayBuffer, encoding?: Base64Variant): string;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Base64 variant.
|
|
43
|
+
*/
|
|
44
|
+
export type Base64Variant = "std" | "rawstd" | "url" | "rawurl";
|
|
45
|
+
|
|
46
|
+
export * as default from "k6/encoding";
|
k6/execution/index.d.ts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Options } from "./../options/index.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Information about the current scenario.
|
|
5
|
+
*/
|
|
6
|
+
export const scenario: {
|
|
7
|
+
/**
|
|
8
|
+
* The assigned name of the running scenario.
|
|
9
|
+
*/
|
|
10
|
+
name: string;
|
|
11
|
+
/**
|
|
12
|
+
* The name of the running Executor type.
|
|
13
|
+
*/
|
|
14
|
+
executor: string;
|
|
15
|
+
/**
|
|
16
|
+
* The Unix timestamp in milliseconds when the scenario started.
|
|
17
|
+
*/
|
|
18
|
+
startTime: number;
|
|
19
|
+
/**
|
|
20
|
+
* Percentage in a 0 to 1 interval of the scenario progress.
|
|
21
|
+
*/
|
|
22
|
+
progress: number;
|
|
23
|
+
/**
|
|
24
|
+
* The unique and zero-based sequential number of the current iteration in the scenario, across the current instance.
|
|
25
|
+
*/
|
|
26
|
+
iterationInInstance: number;
|
|
27
|
+
/**
|
|
28
|
+
* The unique and zero-based sequential number of the current iteration in the scenario.
|
|
29
|
+
*/
|
|
30
|
+
iterationInTest: number;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Information about the current load generator instance.
|
|
35
|
+
*/
|
|
36
|
+
export const instance: {
|
|
37
|
+
/**
|
|
38
|
+
* The number of prematurely interrupted iterations in the current instance.
|
|
39
|
+
*/
|
|
40
|
+
iterationsInterrupted: number;
|
|
41
|
+
/**
|
|
42
|
+
* The number of completed iterations in the current instance.
|
|
43
|
+
*/
|
|
44
|
+
iterationsCompleted: number;
|
|
45
|
+
/**
|
|
46
|
+
* The number of active VUs.
|
|
47
|
+
*/
|
|
48
|
+
vusActive: number;
|
|
49
|
+
/**
|
|
50
|
+
* The number of currently initialized VUs.
|
|
51
|
+
*/
|
|
52
|
+
vusInitialized: number;
|
|
53
|
+
/**
|
|
54
|
+
* The time passed from the start of the current test run in milliseconds.
|
|
55
|
+
*/
|
|
56
|
+
currentTestRunDuration: number;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Control the test execution.
|
|
61
|
+
*/
|
|
62
|
+
export const test: {
|
|
63
|
+
/**
|
|
64
|
+
* Aborts the test run with the exit code 108.
|
|
65
|
+
* https://grafana.com/docs/k6/latest/javascript-api/k6-execution/#test
|
|
66
|
+
* @param input - Aborted message.
|
|
67
|
+
* @example
|
|
68
|
+
* import exec from "k6/execution";
|
|
69
|
+
* exec.test.abort();
|
|
70
|
+
* exec.test.abort('this is the reason');
|
|
71
|
+
*/
|
|
72
|
+
abort(input?: string): void;
|
|
73
|
+
|
|
74
|
+
options: Options;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Information about the current virtual user.
|
|
79
|
+
*/
|
|
80
|
+
export const vu: {
|
|
81
|
+
/**
|
|
82
|
+
* The identifier of the iteration in the current instance.
|
|
83
|
+
*/
|
|
84
|
+
iterationInInstance: number;
|
|
85
|
+
/**
|
|
86
|
+
* The identifier of the iteration in the current scenario.
|
|
87
|
+
*/
|
|
88
|
+
iterationInScenario: number;
|
|
89
|
+
/**
|
|
90
|
+
* The identifier of the VU across the instance.
|
|
91
|
+
*/
|
|
92
|
+
idInInstance: number;
|
|
93
|
+
/**
|
|
94
|
+
* The globally unique (across the whole test run) identifier of the VU.
|
|
95
|
+
*/
|
|
96
|
+
idInTest: number;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Map to set or get VU tags.
|
|
100
|
+
* @deprecated should use `metrics.tags` instead of just `tags`
|
|
101
|
+
*/
|
|
102
|
+
tags: Record<string, number | string | boolean>;
|
|
103
|
+
metrics: {
|
|
104
|
+
/**
|
|
105
|
+
* Map to set or get VU tags.
|
|
106
|
+
*/
|
|
107
|
+
tags: Record<string, number | string | boolean>;
|
|
108
|
+
/**
|
|
109
|
+
* Map to set or get VU metadata.
|
|
110
|
+
*/
|
|
111
|
+
metadata: Record<string, number | string | boolean>;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export * as default from "k6/execution";
|
|
@@ -4192,7 +4192,7 @@ export interface Page {
|
|
|
4192
4192
|
* **Usage**
|
|
4193
4193
|
*
|
|
4194
4194
|
* ```js
|
|
4195
|
-
* import { browser, networkProfiles } from 'k6/
|
|
4195
|
+
* import { browser, networkProfiles } from 'k6/browser';
|
|
4196
4196
|
* ... // redacted
|
|
4197
4197
|
* const context = browser.newContext();
|
|
4198
4198
|
* const page = context.newPage();
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `k6-experimental/csv` module provides efficient ways to handle CSV files in k6, offering faster parsing and lower memory
|
|
3
|
+
* usage compared to traditional JavaScript-based libraries.
|
|
4
|
+
*
|
|
5
|
+
* This module includes functionalities for both full-file parsing and streaming, allowing users to choose between
|
|
6
|
+
* performance and memory optimization.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { SharedArray } from "k6/data";
|
|
10
|
+
import * as fs from "k6/experimental/fs";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The parse function parses an entire CSV file at once and returns a promise
|
|
14
|
+
* that resolves to a `SharedArray` instance.
|
|
15
|
+
*
|
|
16
|
+
* This function uses Go-based processing, which results in faster parsing and
|
|
17
|
+
* lower memory usage compared to JavaScript alternatives.
|
|
18
|
+
*
|
|
19
|
+
* It's ideal for scenarios where performance is a priority, and the entire CSV
|
|
20
|
+
* file can be loaded into memory.
|
|
21
|
+
*
|
|
22
|
+
* @param {fs.File} file - The file path as a `fs.File` instance. Relative paths are resolved relative to the k6 script.
|
|
23
|
+
* @param {Partial<Options>} [options] - An optional configuration object for the parsing operation.
|
|
24
|
+
*/
|
|
25
|
+
export function parse(file: fs.File, options?: Partial<Options>): Promise<typeof SharedArray>;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The `csv.Parser` class provides a streaming parser that reads CSV files
|
|
29
|
+
* line-by-line, offering fine-grained control over the parsing process and
|
|
30
|
+
* minimizing memory consumption.
|
|
31
|
+
*
|
|
32
|
+
* It's well-suited for scenarios where memory efficiency is crucial or when
|
|
33
|
+
* you need to process large CSV files without loading the entire file into memory.
|
|
34
|
+
*/
|
|
35
|
+
export class Parser {
|
|
36
|
+
/**
|
|
37
|
+
* Constructs a new Parser instance.
|
|
38
|
+
*
|
|
39
|
+
* @param {fs.File} file - A csv file to parse, provided as a `fs.File` instance.
|
|
40
|
+
* @param {Partial<Options>} [options] - An optional configuration object for the parser.
|
|
41
|
+
*/
|
|
42
|
+
constructor(file: fs.File, options?: Partial<Options>);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Parses the next record from the CSV file.
|
|
46
|
+
*
|
|
47
|
+
* @returns {Promise<{done: boolean, value: string[]}>} - A promise that
|
|
48
|
+
* resolves to an object with the `done` property set to `true` if the end of the file
|
|
49
|
+
* is reached, and the `value` property set to an array of strings representing the record.
|
|
50
|
+
*/
|
|
51
|
+
next(): Promise<{ done: boolean; value: string[] }>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The Options object describes the configuration available for the operation of parsing CSV
|
|
56
|
+
* files using the `parse` function and the `Parser` class.
|
|
57
|
+
*/
|
|
58
|
+
export interface Options {
|
|
59
|
+
/**
|
|
60
|
+
* The delimiter character used in the CSV file. Default is ','.
|
|
61
|
+
*/
|
|
62
|
+
delimiter: string;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Whether to skip the first line of the CSV file. Default is false.
|
|
66
|
+
*/
|
|
67
|
+
skipFirstLine: boolean;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The line number the parsing should start from. Default is 0.
|
|
71
|
+
*/
|
|
72
|
+
fromLine: number;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The line number the parsing should stop at. Default is undefined.
|
|
76
|
+
*/
|
|
77
|
+
toLine?: number;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export * as default from "k6/experimental/csv";
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/tracing/
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { RefinedParams, RefinedResponse, RequestBody, ResponseType } from "
|
|
11
|
+
import { RefinedParams, RefinedResponse, RequestBody, ResponseType } from "../../http/index.js";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* The instrumentHTTP function instruments the k6 http module
|
|
@@ -204,3 +204,5 @@ export interface Options {
|
|
|
204
204
|
export interface HttpURL {
|
|
205
205
|
__brand: "http-url";
|
|
206
206
|
}
|
|
207
|
+
|
|
208
|
+
export * as default from "k6/experimental/tracing";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CookieJar } from "
|
|
2
|
-
import { ReadableStream } from "
|
|
1
|
+
import { CookieJar } from "../../http/index.js";
|
|
2
|
+
import { ReadableStream } from "../streams/index.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* This module provides an experimental implementation of the WebSocket API
|
|
@@ -37,8 +37,9 @@ export class WebSocket {
|
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* The type of binary data being transmitted over the connection.
|
|
40
|
+
* @default "blob"
|
|
40
41
|
*/
|
|
41
|
-
|
|
42
|
+
binaryType: BinaryType;
|
|
42
43
|
|
|
43
44
|
/**
|
|
44
45
|
* The Websocket constructor returns a newly created WebSocket object.
|
|
@@ -56,7 +57,7 @@ export class WebSocket {
|
|
|
56
57
|
*
|
|
57
58
|
* @param data - the data to send to the server
|
|
58
59
|
*/
|
|
59
|
-
send(data: string | ArrayBuffer | Blob): void;
|
|
60
|
+
send(data: string | ArrayBuffer | Blob | ArrayBufferView): void;
|
|
60
61
|
|
|
61
62
|
/**
|
|
62
63
|
* Bind event names to event handlers to be executed when their
|
k6/global.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ declare global {
|
|
|
56
56
|
* Environment variables.
|
|
57
57
|
* https://grafana.com/docs/k6/latest/using-k6/environment-variables/
|
|
58
58
|
*/
|
|
59
|
-
|
|
59
|
+
var __ENV: { [name: string]: string };
|
|
60
60
|
|
|
61
61
|
// === VU logic only ===
|
|
62
62
|
// ---------------------
|
|
@@ -65,11 +65,19 @@ declare global {
|
|
|
65
65
|
* Current VU number.
|
|
66
66
|
* https://grafana.com/docs/k6/latest/using-k6/execution-context-variables/
|
|
67
67
|
*/
|
|
68
|
-
|
|
68
|
+
var __VU: number;
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* Current iteration number.
|
|
72
72
|
* https://grafana.com/docs/k6/latest/using-k6/execution-context-variables/
|
|
73
73
|
*/
|
|
74
|
-
|
|
74
|
+
var __ITER: number;
|
|
75
|
+
|
|
76
|
+
interface ImportMeta {
|
|
77
|
+
/**
|
|
78
|
+
* Resolve a path to a URL string in the same way an import statement does.
|
|
79
|
+
* https://grafana.com/docs/k6/latest/javascript-api/import.meta/resolve/
|
|
80
|
+
*/
|
|
81
|
+
resolve(specifier: string): string;
|
|
82
|
+
}
|
|
75
83
|
}
|