Browse files

Add JSHint, Mocha and Travis

  • Loading branch information...
1 parent dcdfd8e commit f275d4bf4a39915ccb6d5894fa08985c8fa17dfb @zenorocha zenorocha committed Sep 18, 2013
Showing with 105 additions and 4 deletions.
  1. +51 −0 .jshintrc
  2. +6 −0 .travis.yml
  3. +17 −1 README.md
  4. +12 −3 package.json
  5. +19 −0 test/gif.js
View
51 .jshintrc
@@ -0,0 +1,51 @@
+{
+ "asi": false,
+ "bitwise": true,
+ "boss": true,
+ "browser": true,
+ "curly": true,
+ "debug": false,
+ "eqeqeq": true,
+ "eqnull": false,
+ "es5": false,
+ "esnext": false,
+ "evil": false,
+ "expr": true,
+ "forin": true,
+ "funcscope": false,
+ "globals": {
+ "describe": true,
+ "it": true
+ },
+ "globalstrict": false,
+ "immed": true,
+ "iterator": false,
+ "lastsemic": false,
+ "latedef": true,
+ "laxbreak": false,
+ "laxcomma": false,
+ "loopfunc": false,
+ "maxerr": 10000,
+ "maxlen": 180,
+ "multistr": false,
+ "newcap": true,
+ "noarg": true,
+ "node": true,
+ "noempty": true,
+ "nomen": false,
+ "onevar": true,
+ "passfail": false,
+ "plusplus": false,
+ "proto": false,
+ "quotmark": "single",
+ "scripturl": true,
+ "shadow": false,
+ "smarttabs": false,
+ "strict": false,
+ "sub": false,
+ "supernew": false,
+ "trailing": true,
+ "undef": true,
+ "unused": true,
+ "white": false
+}
View
6 .travis.yml
@@ -0,0 +1,6 @@
+language: node_js
+node_js:
+ - 0.8
+ - 0.10
+before_script:
+ - npm run-script lint
View
18 README.md
@@ -1,4 +1,4 @@
-# GH Gif [![NPM version](https://badge.fury.io/js/gh-gif.png)](http://badge.fury.io/js/gh-gif) [![Dependency Status](https://david-dm.org/node-gh/gh-gif.png)](https://david-dm.org/node-gh/gh-gif)
+# GH Gif [![Build Status](https://secure.travis-ci.org/node-gh/gh-flow.png?branch=master)](https://travis-ci.org/node-gh/gh-flow) [![NPM version](https://badge.fury.io/js/gh-flow.png)](http://badge.fury.io/js/gh-flow) [![Dependency Status](https://david-dm.org/node-gh/gh-flow.png)](https://david-dm.org/node-gh/gh-flow)
![DaftPunktocat](http://zno.io/RMu9/daftpunktocat.gif)
@@ -46,6 +46,22 @@ gh gif 75 --reaction surprised --user node-gh --repo gh-gif
gh gif 75 --image http://media1.giphy.com/media/5DQdk5oZzNgGc/original.gif
```
+## Testing
+
+Check [Travis](https://travis-ci.org/node-gh/gh-gif) for continous integration results.
+
+* Run [JSHint](http://www.jshint.com/), a tool to detect errors and potential problems.
+
+ ```
+npm run-script lint
+ ```
+
+* Run [Mocha](http://visionmedia.github.io/mocha/), a unit test framework.
+
+ ```
+npm run-script test
+ ```
+
## Contributing
1. Fork it!
View
15 package.json
@@ -5,7 +5,8 @@
"author": {
"name": "Zeno Rocha",
"email": "hi@zenorocha.com",
- "web": "http://zenorocha.com"
+ "web": "http://zenorocha.com",
+ "twitter": "zenorocha"
},
"contributors": [{
"name": "Eduardo Lundgren",
@@ -27,15 +28,23 @@
"bin": {
"gh-gif": "bin/gif.js"
},
- "engines": {
- "node": ">=0.8"
+ "scripts": {
+ "lint": "node_modules/.bin/jshint bin/ test/",
+ "test": "node_modules/.bin/mocha --reporter list"
},
"dependencies": {
"async": "0.2.9",
"giphy-wrapper": "0.0.1"
},
+ "devDependencies": {
+ "jshint": "2.1.2",
+ "mocha": "1.12.0"
+ },
"peerDependencies": {
"gh": ">=1.4.0"
},
+ "engines": {
+ "node": ">=0.8"
+ },
"preferGlobal": "true"
}
View
19 test/gif.js
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2013, All Rights Reserved.
+ *
+ * Code licensed under the BSD License:
+ * https://github.com/node-gh/gh/blob/master/LICENSE.md
+ *
+ * @author Zeno Rocha <hi@zenorocha.com>
+ */
+
+// -- Requires -----------------------------------------------------------------
+var assert = require('assert');
+
+// -- Suites -------------------------------------------------------------------
+describe('A test suite', function() {
+ it('should return a hello world message', function(){
+ var hello = 'Hello world :)';
+ assert.equal('Hello world :)', hello);
+ });
+});

0 comments on commit f275d4b

Please sign in to comment.