Giter Club home page Giter Club logo

nodejs-tdd-boilerplate's Introduction

nodejs-tdd-boilerplate

NodeJS TDD Boilerplate

A basic boilerplate for NodeJS REST API applications that emphasizes code consistency and excellent test coverage.

Features

  • mocha test framework.
  • sinon stubbing framework.
  • istanbul test coverage framework.
  • jshint code linting.
  • restify REST framework.
  • choice between make and jake build tool.
  • choice of combined or separate servers for each 'app'.
  • servers can run on multiple ports.

Planned

  • Actual model implementation example instead of stubbed model.

Setup

Assuming you already have NodeJS 0.8.11 or higher installed:

git clone https://github.com/BryanDonovan/nodejs-tdd-boilerplate.git
cd nodejs-tdd-boilerplate
npm install .
make

Note: to use jake you need to install it globally:

npm install -g jake

You can view available jake tasks with jake -T.

The jake or make command will run JSHint, all the mocha unit tests, and check the test coverage. To view the test coverage report, open coverage/lcov-report/index.html after running make.

You can also run make test to just run the tests with coverage, make test-cov to run the tests and attempt to open the coverage report in your browser, and make lint to run JSHint.

To run the acceptance tests (which are just mocha tests), first start the server:

bin/start all

Then:

make test-acceptance

or:

jake test:acceptance

You can launch the sever on more than one port via bin/launch, for example:

bin/launch users

.. will launch the users app on two ports (specified in config.js).

Then you can run the acceptance tests against either of those ports by specifying the PORT env variable:

PORT=12100 make test-acceptance

nodejs-tdd-boilerplate's People

Contributors

bryandonovan avatar killmenot avatar

Watchers

James Cloos avatar Wenming Huang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.