You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 13, 2019. It is now read-only.
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.
This should also say something about things like // Flags: --expose-internals ... specifically, adding a // Flags comment in the pre-amble of the test (along with the 'use strict'; allows the test to be run with specific Node.js command line flags set. In the case of --expose-internals, it allows a test to require the various internal/* modules used internally by Node core.
- 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).
@Trott I wanted to incoporate @jasnell suggestions first, but had no time in the last few weeks :(. I think it can be publishable as it is and can improve it afterwards.
General question: where do you think this doc should live in?
General question: where do you think this doc should live in?
It's short enough and important/helpful enough that I would make it part of test/README.md in the main core repository. I think the README needs (at least) three things:
How to run the tests
How to write tests (what this doc is!)
What the various tests are (this is what's there already, although it can use some expansion perhaps)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
None yet
5 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It's a very basic guide on how to write a
nodetest. 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
commonAPI.