@@ -25,39 +25,44 @@ Let's analyze this basic test from the Node.js test suite:
2525``` javascript 
2626' use strict' //  1
2727const  common  =  require (' ../common' //  2
28- 
29- //  This test ensures that the http-parser can handle UTF-8 characters  // 4
30- //  in the http header.                                                 // 5
31- 
32- const  assert  =  require (' assert' //  7
33- const  http  =  require (' http' //  8
34- 
35- const  server  =  http .createServer (common .mustCall ((req , res ) =>  {       //  10
36-   res .end (' ok' //  11
37- }));                                                                   //  12
38- server .listen (0 , () =>  {                                               //  13
39-   http .get ({                                                           //  14
40-     port:  server .address ().port ,                                       //  15
41-     headers:  { ' Test' :  ' Düsseldorf' //  16
42-   }, common .mustCall ((res ) =>  {                                        //  17
43-     assert .strictEqual (res .statusCode , 200 );                           //  18
44-     server .close ();                                                    //  19
45-   }));                                                                 //  20
46- });                                                                    //  21
28+ const  fixtures  =  require (' ../common/fixtures' //  3
29+ 
30+ //  This test ensures that the http-parser can handle UTF-8 characters  // 5
31+ //  in the http header.                                                 // 6
32+ 
33+ const  assert  =  require (' assert' //  8
34+ const  http  =  require (' http' //  9
35+ 
36+ const  server  =  http .createServer (common .mustCall ((req , res ) =>  {       //  11
37+   res .end (' ok' //  12
38+ }));                                                                   //  13
39+ server .listen (0 , () =>  {                                               //  14
40+   http .get ({                                                           //  15
41+     port:  server .address ().port ,                                       //  16
42+     headers:  { ' Test' :  ' Düsseldorf' //  17
43+   }, common .mustCall ((res ) =>  {                                        //  18
44+     assert .strictEqual (res .statusCode , 200 );                           //  19
45+     server .close ();                                                    //  20
46+   }));                                                                 //  21
47+ });                                                                    //  22
48+ //  ...                                                                 // 23
4749``` 
4850
49- ### ** Lines 1-2 **  
51+ ### ** Lines 1-3 **  
5052
5153``` javascript 
5254' use strict' 
5355const  common  =  require (' ../common' 
56+ const  fixtures  =  require (' ../common/fixtures' 
5457``` 
5558
5659The first line enables strict mode. All tests should be in strict mode unless
5760the nature of the test requires that the test run without it.
5861
5962The second line loads the ` common `  module. The [ ` common `  module] [ ]  is a helper
60- module that provides useful tools for the tests.
63+ module that provides useful tools for the tests. Some common functionality has
64+ been extracted into submodules, which are required separately like the fixtures
65+ module here.
6166
6267Even if a test uses no functions or other properties exported by ` common ` ,
6368the test should still include the ` common `  module before any other modules. This
@@ -70,7 +75,7 @@ assigning it to an identifier:
7075require (' ../common' 
7176``` 
7277
73- ### ** Lines 4-5 **  
78+ ### ** Lines 5-6 **  
7479
7580``` javascript 
7681//  This test ensures that the http-parser can handle UTF-8 characters
@@ -80,7 +85,7 @@ require('../common');
8085A test should start with a comment containing a brief description of what it is
8186designed to test.
8287
83- ### ** Lines 7-8 **  
88+ ### ** Lines 8-9 **  
8489
8590``` javascript 
8691const  assert  =  require (' assert' 
@@ -95,7 +100,7 @@ The require statements are sorted in
95100[ ASCII] [ ]  order (digits, upper
96101case, ` _ ` , lower case).
97102
98- ### ** Lines 10-21 **  
103+ ### ** Lines 11-22 **  
99104
100105This is the body of the test. This test is simple, it just tests that an
101106HTTP server accepts ` non-ASCII `  characters in the headers of an incoming
0 commit comments