Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. Requires
  2.  
  3. - git
  4. - nodejs (npm)
  5.  
  6. Create the project:
  7.  
  8. ```bash
  9. PROJECT="my-project-name"
  10. mkdir "$PROJECT"
  11. cd "$PROJECT"
  12. git init
  13. npm init
  14. # name: (default)
  15. # version: (default)
  16. # description: what my project does
  17. # entry point: (default)
  18. # test command: mocha src/test/js
  19. # git repository: (empty)
  20. # keywords: (empty)
  21. # author: My Name <myemail@example.com>
  22. # license: your choice
  23. # Is this ok? (default)
  24. ```
  25.  
  26. Set up testing
  27.  
  28. ```bash
  29. mkdir -p src/test/js
  30. npm install --save-dev mocha
  31. npm install --save-dev expect
  32. npm test
  33. ```
  34.  
  35. Example test:
  36.  
  37. ```javascript
  38. var expect = require('expect');
  39. describe('Array', function() {
  40. describe('#indexOf()', function () {
  41. it('should return -1 when the value is not present', function () {
  42. expect([1,2,3].indexOf(5)).toEqual(-1);
  43. expect([1,2,3].indexOf(0)).toEqual(-1);
  44. });
  45. });
  46. });
  47. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement