-
Notifications
You must be signed in to change notification settings - Fork 19
[RFC] doc: add How to write a node test
guide
#30
Conversation
83e90e2
to
f746ce6
Compare
@@ -0,0 +1,139 @@ | |||
# How to write a node test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
node
-> Node.js
f746ce6
to
f233114
Compare
Updated per @cjihrig comments. Thanks!! |
const common = require('../common'); | ||
``` | ||
|
||
These 2 lines are mandatory and should be included on every test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you spell out "two"
f233114
to
13b4038
Compare
Updated! Thanks again @cjihrig ! |
LGTM |
This should also say something about things like |
## General recommendations | ||
|
||
- The use of timers is discouraged, unless we're testing timers. The reasons for this are multiple. Mainly, they are a source of flakiness. For a thorough explanation go [here](https://github.com/nodejs/testing/issues/27). | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps something about common.platformTimeout()
here?
Great work @santigimeno! Great to see this. Left a few suggestions. |
LGTM. Thank you so much for doing this, @santigimeno! |
Bump! Is this publishable as it stands or does it need a few tweaks? |
It's short enough and important/helpful enough that I would make it part of
|
Shouldn't this be PR'd to nodejs/node under |
ah, yes, good point |
b7379c2
to
d610c5f
Compare
Opened PR @ nodejs/node: nodejs/node#6984, incorporating @jasnell suggestions. Closing this. Thank for all the comments! |
It's a very basic guide on how to write a
node
test. It surely needs more work (and syntax corrections!) but it can be a good starting point. Comments are welcome. Thanks.P.S.: I'm planning to create an accompanying text documenting the
common
API.