Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Requires
- - git
- - nodejs (npm)
- Create the project:
- ```bash
- PROJECT="my-project-name"
- mkdir "$PROJECT"
- cd "$PROJECT"
- git init
- npm init
- # name: (default)
- # version: (default)
- # description: what my project does
- # entry point: (default)
- # test command: mocha src/test/js
- # git repository: (empty)
- # keywords: (empty)
- # author: My Name <myemail@example.com>
- # license: your choice
- # Is this ok? (default)
- ```
- Set up testing
- ```bash
- mkdir -p src/test/js
- npm install --save-dev mocha
- npm install --save-dev expect
- npm test
- ```
- Example test:
- ```javascript
- var expect = require('expect');
- describe('Array', function() {
- describe('#indexOf()', function () {
- it('should return -1 when the value is not present', function () {
- expect([1,2,3].indexOf(5)).toEqual(-1);
- expect([1,2,3].indexOf(0)).toEqual(-1);
- });
- });
- });
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement