@@ -29,7 +29,7 @@ For example, look for `test-streams` when writing a test for `lib/streams.js`.
2929
3030Let's analyze this basic test from the Node.js test suite:
3131
32- ``` javascript
32+ ``` js
3333' use strict' ; // 1
3434const common = require (' ../common' ); // 2
3535const fixtures = require (' ../common/fixtures' ); // 3
@@ -57,7 +57,7 @@ server.listen(0, () => { // 14
5757
5858### ** Lines 1-3**
5959
60- ``` javascript
60+ ``` js
6161' use strict' ;
6262const common = require (' ../common' );
6363const fixtures = require (' ../common/fixtures' );
@@ -78,13 +78,13 @@ the test leaks variables into the global space. In situations where a test uses
7878no functions or other properties exported by ` common ` , include it without
7979assigning it to an identifier:
8080
81- ``` javascript
81+ ``` js
8282require (' ../common' );
8383```
8484
8585### ** Lines 5-6**
8686
87- ``` javascript
87+ ``` js
8888// This test ensures that the http-parser can handle UTF-8 characters
8989// in the http header.
9090```
@@ -94,7 +94,7 @@ designed to test.
9494
9595### ** Lines 8-9**
9696
97- ``` javascript
97+ ``` js
9898const assert = require (' assert' );
9999const http = require (' http' );
100100```
@@ -136,7 +136,7 @@ In the event a test needs a timer, consider using the
136136` common.platformTimeout() ` method. It allows setting specific timeouts
137137depending on the platform:
138138
139- ``` javascript
139+ ``` js
140140const timer = setTimeout (fail, common .platformTimeout (4000 ));
141141```
142142
@@ -155,7 +155,7 @@ One interesting case is `common.mustCall`. The use of `common.mustCall` may
155155avoid the use of extra variables and the corresponding assertions. Let's
156156explain this with a real test from the test suite.
157157
158- ``` javascript
158+ ``` js
159159' use strict' ;
160160require (' ../common' );
161161const assert = require (' assert' );
@@ -189,7 +189,7 @@ const server = http.createServer((req, res) => {
189189
190190This test could be greatly simplified by using ` common.mustCall ` like this:
191191
192- ``` javascript
192+ ``` js
193193' use strict' ;
194194const common = require (' ../common' );
195195const http = require (' http' );
@@ -216,7 +216,7 @@ provides a simple countdown mechanism for tests that require a particular
216216action to be taken after a given number of completed tasks (for instance,
217217shutting down an HTTP server after a specific number of requests).
218218
219- ``` javascript
219+ ``` js
220220const Countdown = require (' ../common/countdown' );
221221
222222const countdown = new Countdown (2 , () => {
@@ -237,7 +237,7 @@ hence, the test fail - in the case of an `unhandledRejection` event. It is
237237possible to disable it with ` common.disableCrashOnUnhandledRejection() ` if
238238needed.
239239
240- ``` javascript
240+ ``` js
241241const common = require (' ../common' );
242242const assert = require (' assert' );
243243const fs = require (' fs' ).promises ;
@@ -257,7 +257,7 @@ test followed by the flags. For example, to allow a test to require some of the
257257` internal/* ` modules, add the ` --expose-internals ` flag.
258258A test that would require ` internal/freelist ` could start like this:
259259
260- ``` javascript
260+ ``` js
261261' use strict' ;
262262
263263// Flags: --expose-internals
0 commit comments