Skip to content

Commit 561225e

Browse files
committed
Add tests using Mocha
1 parent a9ad4da commit 561225e

File tree

4 files changed

+56
-5
lines changed

4 files changed

+56
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.DS_Store
22
node_modules
3+
test/temp

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# jQuery generator
1+
# jQuery generator [![Build Status](https://secure.travis-ci.org/zenorocha/generator-jquery.png?branch=master)](https://travis-ci.org/zenorocha/generator-jquery)
22

33
> A Yeoman generator that provides a functional boilerplate to easily create jQuery plugins out of the box.
44
@@ -17,7 +17,9 @@ Check [jQuery Boilerplate's](http://github.com/jquery-boilerplate/boilerplate) r
1717

1818
## History
1919

20-
* v0.0.1 May 10, 2013
20+
* v0.1.0 May 10, 2013
21+
* Added continous integration using [Travis](https://travis-ci.org/)
22+
* Added tests using [Mocha](http://visionmedia.github.io/mocha/)
2123
* Published package on [NPM](https://npmjs.org/package/generator-jquery)
2224
* Cloned Addy's [Generator Boilerplate](https://github.com/addyosmani/generator-boilerplate)
2325

package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,22 @@
1717
"name": "Zeno Rocha",
1818
"email": "[email protected]"
1919
},
20-
"engines": {
21-
"node": ">=0.8.0"
22-
},
2320
"license": [
2421
{
2522
"type": "MIT",
2623
"url": "http://zenorocha.mit-license.org/"
2724
}
2825
],
26+
"scripts": {
27+
"test": "mocha --reporter spec"
28+
},
29+
"engines": {
30+
"node": ">=0.8.0"
31+
},
2932
"dependencies": {
3033
"yeoman-generator": "~0.10.2"
34+
},
35+
"devDependencies": {
36+
"mocha": "~1.9.0"
3137
}
3238
}

test/test.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/* global describe, beforeEach, it */
2+
'use strict';
3+
4+
var path = require('path');
5+
var helpers = require('yeoman-generator').test;
6+
7+
describe('jQuery generator test', function () {
8+
beforeEach(function (done) {
9+
helpers.testDirectory(path.join(__dirname, 'temp'), function (err) {
10+
if (err) {
11+
return done(err);
12+
}
13+
14+
this.app = helpers.createGenerator('jquery:app', [
15+
'../../app'
16+
]);
17+
done();
18+
}.bind(this));
19+
});
20+
21+
it('creates expected files', function (done) {
22+
var expected = [
23+
'.editorconfig',
24+
'.gitignore',
25+
'.jshintrc',
26+
'.travis.yml',
27+
'Gruntfile.js',
28+
'boilerplate.jquery.json',
29+
'dist/jquery.boilerplate.js',
30+
'dist/jquery.boilerplate.min.js',
31+
'package.json',
32+
'src/jquery.boilerplate.coffee',
33+
'src/jquery.boilerplate.js'
34+
];
35+
36+
this.app.options['skip-install'] = true;
37+
this.app.run({}, function () {
38+
helpers.assertFiles(expected);
39+
done();
40+
});
41+
});
42+
});

0 commit comments

Comments
 (0)