Skip to content

Commit 5aa210a

Browse files
committed
doc: specify sorted requires in tests
And allow anchor links to the various sections, to more easily reference them when reviewing PRs. PR-URL: #10716 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
1 parent 3c2a936 commit 5aa210a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

doc/guides/writing-tests.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ Let's analyze this very basic test from the Node.js test suite:
3030
4 // This test ensures that the http-parser can handle UTF-8 characters
3131
5 // in the http header.
3232
6
33-
7 const http = require('http');
34-
8 const assert = require('assert');
33+
7 const assert = require('assert');
34+
8 const http = require('http');
3535
9
3636
10 const server = http.createServer(common.mustCall((req, res) => {
3737
11 res.end('ok');
@@ -47,7 +47,7 @@ Let's analyze this very basic test from the Node.js test suite:
4747
21 });
4848
```
4949

50-
**Lines 1-2**
50+
### **Lines 1-2**
5151

5252
```javascript
5353
'use strict';
@@ -70,7 +70,7 @@ by `common` are used, it can be included without assigning it to an identifier:
7070
require('../common');
7171
```
7272

73-
**Lines 4-5**
73+
### **Lines 4-5**
7474

7575
```javascript
7676
// This test ensures that the http-parser can handle UTF-8 characters
@@ -80,19 +80,19 @@ require('../common');
8080
A test should start with a comment containing a brief description of what it is
8181
designed to test.
8282

83-
**Lines 7-8**
83+
### **Lines 7-8**
8484

8585
```javascript
86-
const http = require('http');
8786
const assert = require('assert');
87+
const http = require('http');
8888
```
8989

9090
These modules are required for the test to run. Except for special cases, these
9191
modules should only include core modules.
9292
The `assert` module is used by most of the tests to check that the assumptions
9393
for the test are met.
9494

95-
**Lines 10-21**
95+
### **Lines 10-21**
9696

9797
This is the body of the test. This test is quite simple, it just tests that an
9898
HTTP server accepts `non-ASCII` characters in the headers of an incoming

0 commit comments

Comments
 (0)