Skip to content

Commit 783d7b1

Browse files
committed
refactor: md-k6:skip tags to the jslib-testing docs
1 parent c6db16c commit 783d7b1

34 files changed

+125
-201
lines changed

docs/sources/k6/next/javascript-api/jslib/testing/_index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ The k6 testing library source code is available on [GitHub](https://github.com/g
2424

2525
To use the testing library in your k6 script, import it in your tests directly from the jslib repository:
2626

27+
<!-- md-k6:skip -->
28+
2729
```javascript
2830
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
2931
```
@@ -32,6 +34,8 @@ import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_
3234

3335
### Protocol Testing
3436

37+
<!-- md-k6:skip -->
38+
3539
```javascript
3640
import { check } from 'k6';
3741
import http from 'k6/http';
@@ -53,6 +57,8 @@ export default function () {
5357

5458
### Browser Testing
5559

60+
<!-- md-k6:skip -->
61+
5662
```javascript
5763
import { browser } from 'k6/experimental/browser';
5864
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
@@ -72,6 +78,8 @@ export default async function () {
7278

7379
Create configured `expect` instances for custom behavior:
7480

81+
<!-- md-k6:skip -->
82+
7583
```javascript
7684
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
7785

docs/sources/k6/next/javascript-api/jslib/testing/configure.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The imported `expect` instance remains unchanged and continues to use the defaul
1515
## Syntax
1616

1717
<!-- eslint-skip -->
18+
<!-- md-k6:skip -->
1819

1920
```javascript
2021
const configuredExpect = expect.configure(options);
@@ -46,6 +47,8 @@ const configuredExpect = expect.configure(options);
4647

4748
The `timeout` option controls how long retrying assertions will wait for a condition to become true:
4849

50+
<!-- md-k6:skip -->
51+
4952
```javascript
5053
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
5154

@@ -60,6 +63,8 @@ const slowExpect = expect.configure({
6063

6164
The `display` and `colorize` options control how assertion failures are reported:
6265

66+
<!-- md-k6:skip -->
67+
6368
```javascript
6469
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
6570

@@ -74,6 +79,8 @@ const inlineExpect = expect.configure({
7479

7580
The `softMode` option controls whether failed assertions stop test execution:
7681

82+
<!-- md-k6:skip -->
83+
7784
```javascript
7885
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
7986

@@ -108,6 +115,7 @@ k6 run test.js
108115
### Basic Configuration
109116

110117
<!-- eslint-skip -->
118+
<!-- md-k6:skip -->
111119

112120
```javascript
113121
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
@@ -131,6 +139,8 @@ export default function () {
131139

132140
### Browser Testing Configuration
133141

142+
<!-- md-k6:skip -->
143+
134144
```javascript
135145
import { browser } from 'k6/experimental/browser';
136146
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
@@ -152,6 +162,8 @@ export default async function () {
152162

153163
### CI/CD Configuration
154164

165+
<!-- md-k6:skip -->
166+
155167
```javascript
156168
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
157169

@@ -165,6 +177,8 @@ const ciExpect = expect.configure({
165177

166178
### Development vs Production
167179

180+
<!-- md-k6:skip -->
181+
168182
```javascript
169183
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
170184

@@ -182,6 +196,7 @@ const envExpect = expect.configure({
182196
### Multiple Configured Instances
183197

184198
<!-- eslint-skip -->
199+
<!-- md-k6:skip -->
185200

186201
```javascript
187202
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
@@ -209,6 +224,8 @@ export default function () {
209224

210225
### Soft Assertion Examples
211226

227+
<!-- md-k6:skip -->
228+
212229
```javascript
213230
import http from 'k6/http';
214231
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';

docs/sources/k6/next/javascript-api/jslib/testing/expect.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The `expect()` function is the main entry point for creating assertions in the k
1111
## Syntax
1212

1313
<!-- eslint-skip -->
14+
<!-- md-k6:skip -->
1415

1516
```javascript
1617
expect(actual);
@@ -38,6 +39,8 @@ The `expect()` function wraps a value and returns an expectation object that pro
3839

3940
Standard assertions evaluate immediately and do not retry:
4041

42+
<!-- md-k6:skip -->
43+
4144
```javascript
4245
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
4346

@@ -49,6 +52,8 @@ expect([1, 2, 3]).toContain(2);
4952

5053
Retrying assertions automatically retry until they pass or timeout. These are particularly useful for browser testing where elements may not be immediately available:
5154

55+
<!-- md-k6:skip -->
56+
5257
```javascript
5358
import { browser } from 'k6/experimental/browser';
5459
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
@@ -67,6 +72,8 @@ export default async function () {
6772

6873
All assertions can be negated using the `.not` property:
6974

75+
<!-- md-k6:skip -->
76+
7077
```javascript
7178
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
7279

@@ -78,6 +85,8 @@ expect('hello').not.toContain('world');
7885

7986
By default, failed assertions will terminate the test execution. Soft assertions, on the other hand, don't terminate the test execution when they fail, but mark the test as failed, leading k6 to eventually exit with code `110`.
8087

88+
<!-- md-k6:skip -->
89+
8190
```javascript
8291
import exec from 'k6/execution';
8392
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
@@ -100,6 +109,7 @@ export default function () {
100109
Note that soft assertions can be [configured](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/testing/configure) to throw an exception (and effectively failing the iteration where it happens) instead.
101110

102111
<!-- eslint-skip -->
112+
<!-- md-k6:skip -->
103113

104114
```javascript
105115
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
@@ -118,6 +128,8 @@ export default function () {
118128

119129
### API Testing
120130

131+
<!-- md-k6:skip -->
132+
121133
```javascript
122134
import http from 'k6/http';
123135
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
@@ -142,6 +154,8 @@ export default function () {
142154

143155
### Browser Testing
144156

157+
<!-- md-k6:skip -->
158+
145159
```javascript
146160
import { browser } from 'k6/experimental/browser';
147161
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
@@ -204,7 +218,3 @@ export default async function () {
204218
| [toHaveText(text, options?)](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/retrying-assertions/tohavetext) | Element text content |
205219
| [toHaveValue(value)](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/retrying-assertions/tohavevalue) | Input element value |
206220

207-
## See Also
208-
209-
- [expect.configure()]({{< relref "./configure" >}}) - Configure global assertion behavior
210-
- [Playwright Test Assertions](https://playwright.dev/docs/test-assertions) - Playwright's assertion documentation

docs/sources/k6/next/javascript-api/jslib/testing/non-retrying-assertions/_index.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Non-retrying assertions differ from [retrying assertions](https://grafana.com/do
1515
- **Have no timeout behavior** - They either pass or fail instantly
1616
- **Are ideal for static content** - Perfect for testing values that don't change over time
1717

18+
<!-- md-k6:skip -->
19+
1820
```javascript
1921
import http from 'k6/http';
2022
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
@@ -94,6 +96,7 @@ Non-retrying assertions are best suited for:
9496
### API Response Validation
9597

9698
<!-- eslint-skip -->
99+
<!-- md-k6:skip -->
97100

98101
```javascript
99102
export default function () {
@@ -118,6 +121,7 @@ export default function () {
118121
### Data Validation
119122

120123
<!-- eslint-skip -->
124+
<!-- md-k6:skip -->
121125

122126
```javascript
123127
export default function () {
@@ -148,6 +152,7 @@ export default function () {
148152
### Configuration Testing
149153

150154
<!-- eslint-skip -->
155+
<!-- md-k6:skip -->
151156

152157
```javascript
153158
export default function () {
@@ -172,6 +177,7 @@ export default function () {
172177
### Graceful Error Handling
173178

174179
<!-- eslint-skip -->
180+
<!-- md-k6:skip -->
175181

176182
```javascript
177183
export default function () {
@@ -190,10 +196,5 @@ export default function () {
190196
}
191197
```
192198

193-
## See Also
194-
195-
- [Retrying Assertions](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/retrying-assertions) - Asynchronous assertions for dynamic content
196-
- [expect.configure()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/configure) - Configure global assertion behavior
197-
- [expect()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/expect) - Main assertion function
198199

199200
{{< section >}}

docs/sources/k6/next/javascript-api/jslib/testing/non-retrying-assertions/toBe.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The `toBe()` method asserts that the actual value is exactly equal to the expect
1111
## Syntax
1212

1313
<!-- eslint-skip -->
14+
<!-- md-k6:skip -->
1415

1516
```javascript
1617
expect(actual).toBe(expected);
@@ -37,6 +38,8 @@ Use `toBe()` when you want to assert that two values are the same reference or p
3738

3839
## Usage
3940

41+
<!-- md-k6:skip -->
42+
4043
```javascript
4144
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
4245

@@ -49,8 +52,3 @@ export default function () {
4952
}
5053
```
5154

52-
## See Also
53-
54-
- [toEqual()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/non-retrying-assertions/toequal) - Deep equality comparison
55-
- [toBeCloseTo()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/non-retrying-assertions/tobecloseto) - Floating point comparison
56-
- [expect()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/expect) - Main assertion function

docs/sources/k6/next/javascript-api/jslib/testing/non-retrying-assertions/toBeCloseTo.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The `toBeCloseTo()` method asserts that a number is close to another number with
1111
## Syntax
1212

1313
<!-- eslint-skip -->
14+
<!-- md-k6:skip -->
1415

1516
```javascript
1617
expect(actual).toBeCloseTo(expected);
@@ -40,6 +41,8 @@ This is particularly useful when working with floating-point arithmetic where ex
4041

4142
## Usage
4243

44+
<!-- md-k6:skip -->
45+
4346
```javascript
4447
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
4548

@@ -58,10 +61,3 @@ export default function () {
5861
}
5962
```
6063

61-
## See Also
62-
63-
- [toBe()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/non-retrying-assertions/tobe) - Exact equality comparison
64-
- [toBeGreaterThan()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/non-retrying-assertions/tobegreaterthan) - Numeric greater than comparison
65-
- [toBeLessThan()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/non-retrying-assertions/tobelessthan) - Numeric less than comparison
66-
- [toEqual()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/non-retrying-assertions/toequal) - Deep equality comparison
67-
- [expect()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/expect) - Main assertion function

docs/sources/k6/next/javascript-api/jslib/testing/non-retrying-assertions/toBeDefined.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The `toBeDefined()` method asserts that a value is defined, meaning it is not `u
1111
## Syntax
1212

1313
<!-- eslint-skip -->
14+
<!-- md-k6:skip -->
1415

1516
```javascript
1617
expect(actual).toBeDefined();
@@ -29,6 +30,8 @@ The `toBeDefined()` method checks if a value is defined (not `undefined`). It pa
2930

3031
## Usage
3132

33+
<!-- md-k6:skip -->
34+
3235
```javascript
3336
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
3437

@@ -43,10 +46,3 @@ export default function () {
4346
}
4447
```
4548

46-
## See Also
47-
48-
- [toBeUndefined()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/non-retrying-assertions/tobeundefined) - Assert value is undefined
49-
- [toBeNull()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/non-retrying-assertions/tobenull) - Assert value is null
50-
- [toBeTruthy()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/non-retrying-assertions/tobetruthy) - Assert value is truthy
51-
- [toBeFalsy()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/non-retrying-assertions/tobefalsy) - Assert value is falsy
52-
- [expect()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/expect) - Main assertion function

docs/sources/k6/next/javascript-api/jslib/testing/non-retrying-assertions/toBeFalsy.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The `toBeFalsy()` method asserts that a value is falsy in JavaScript. A value is
1111
## Syntax
1212

1313
<!-- eslint-skip -->
14+
<!-- md-k6:skip -->
1415

1516
```javascript
1617
expect(actual).toBeFalsy();
@@ -40,6 +41,8 @@ All other values are truthy.
4041

4142
## Usage
4243

44+
<!-- md-k6:skip -->
45+
4346
```javascript
4447
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
4548

@@ -55,10 +58,3 @@ export default function () {
5558
}
5659
```
5760

58-
## See Also
59-
60-
- [toBeTruthy()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/non-retrying-assertions/tobetruthy) - Assert value is truthy
61-
- [toBeUndefined()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/non-retrying-assertions/tobeundefined) - Assert value is undefined
62-
- [toBeNull()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/non-retrying-assertions/tobenull) - Assert value is null
63-
- [toBe()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/non-retrying-assertions/tobe) - Exact equality comparison
64-
- [expect()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/expect) - Main assertion function

docs/sources/k6/next/javascript-api/jslib/testing/non-retrying-assertions/toBeGreaterThan.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The `toBeGreaterThan()` method asserts that a numeric value is greater than anot
1111
## Syntax
1212

1313
<!-- eslint-skip -->
14+
<!-- md-k6:skip -->
1415

1516
```javascript
1617
expect(actual).toBeGreaterThan(expected);
@@ -35,6 +36,8 @@ The `toBeGreaterThan()` method performs a numeric comparison using the `>` opera
3536

3637
## Usage
3738

39+
<!-- md-k6:skip -->
40+
3841
```javascript
3942
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
4043

@@ -46,9 +49,3 @@ export default function () {
4649
}
4750
```
4851

49-
## See Also
50-
51-
- [toBeLessThan()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/non-retrying-assertions/tobelessthan) - Numeric less than comparison
52-
- [toBeGreaterThanOrEqual()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/non-retrying-assertions/tobegreaterthanorequal) - Numeric greater than or equal comparison
53-
- [toBeCloseTo()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/non-retrying-assertions/tobecloseto) - Floating point comparison
54-
- [expect()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/expect) - Main assertion function

0 commit comments

Comments
 (0)