- Install Node.js
- Checkouts source code from github:
git clone https://github.com/conkua/testing-with-nodejs.git
- Changes to project home directory:
cd testing-with-nodejs - Installs dependencies using
npm:npm install
Runs lab #01 examples (all of examples):
EXAMPLE=0,1,2,3 node lab/simple-promise-example/simple-example-using-setTimeout.js
Runs an individual example:
EXAMPLE=1 node lab/simple-promise-example/simple-example-using-setTimeout.js
Runs lab #01 examples (all of examples):
EXAMPLE=0,1,2,3 node lab/simple-promise-example/simple-example-using-setTimeout-with-handle-error.js
Runs an individual example:
EXAMPLE=1 node lab/simple-promise-example/simple-example-using-setTimeout-with-handle-error.js
The example promise-start-stop-servers is used to demonstrate how to start/stop servers for testing. The testcase script should start server programmatically and waiting for starting completed before run the testing code.
To run this example, use the following command line:
cd lab/promise-start-stop-servers
npm install
DEBUG=tdd* node_modules/.bin/mocha test/tdd/web-server-test.jsLaunches this example as the following:
cd lab/log-message-collection
npm install
DEBUG=tdd*,bdd* node_modules/.bin/mocha test/bdd/web-server-test.js