ServerJS/Unit Testing/A: Difference between revisions

run returns status code
m (typos and refinements)
(run returns status code)
 
Line 62: Line 62:
== Test ==
== Test ==


The "test" module provides a "run" method that runs unit tests and catalogs their results.  The idiom for a self-running test module program would be:
The "test" module provides a "run" method that runs unit tests and catalogs their results.  The "run" method must return the total number of failures, suitable for use as a process exit status code.  The idiom for a self-running test module program would be:


  if (module.id == require.main)  
  if (module.id == require.main)  
171

edits