Skip to content

Instantly share code, notes, and snippets.

@BridgeAR
Created February 16, 2018 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BridgeAR/869a8baf488cfec40b761f42179f8fee to your computer and use it in GitHub Desktop.
Save BridgeAR/869a8baf488cfec40b761f42179f8fee to your computer and use it in GitHub Desktop.
Writing tests fpr Node.js
About writing a test:
The tests here work the same as if you would write code for your own project. So what you want to do is to write some code that would actually fail without this change. I guess you should know how to get there as you found out that it does not always emit a close when finishing.
The only difference here is that you have to include the "common" part as first require statement as done in every test file in the test folder. You probably want to add a new file in the "parallel" part.
In addition to that you have some extra helper functions that you find in the common part and that also has a individual documentation. But you should probably not need that at all.
To run the tests you first have to build the node executable (I guess you use a unix system, so run make -j4. On Windows it is something with the bat file ;-) ).
When that is done (it could take a while when doing it for the first time...) you can run the tests by running make -j4 test or only your test file with: python ./tools/test.py parallel/test-http-YOUR_FILE_NAME.js.
I hope that helps? :-)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment