Skip to content

Commit 9cce019

Browse files
committed
doc: restrict the ES.Next features usage in tests
PR-URL: nodejs#11452 Refs: nodejs#11290 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 4a642b9 commit 9cce019

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

doc/guides/writing-tests.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,21 @@ const assert = require('assert');
189189
const freelist = require('internal/freelist');
190190
```
191191

192+
### ES.Next features
193+
194+
For performance considerations, we only use a selected subset of ES.Next
195+
features in JavaScript code in the `lib` directory. However, when writing
196+
tests, for the ease of backporting, it is encouraged to use those ES.Next
197+
features that can be used directly without a flag in [all maintained branches]
198+
(https://github.com/nodejs/lts), you can check [node.green](http://node.green)
199+
for all available features in each release.
200+
201+
For example:
202+
203+
* `let` and `const` over `var`
204+
* Template literals over string concatenation
205+
* Arrow functions when appropriate
206+
192207
## Naming Test Files
193208

194209
Test files are named using kebab casing. The first component of the name is

0 commit comments

Comments
 (0)