Skip to content

Commit

Permalink
Fixed mocha test errors. Moved mocha timeout setting to package.json.
Browse files Browse the repository at this point in the history
  • Loading branch information
sidneys committed Feb 5, 2015
1 parent cc6d1ef commit 2249151
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 43 deletions.
3 changes: 1 addition & 2 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,7 @@ module.exports = generators.Base.extend({
fs.rename(path.join(appPath, 'img'), path.join(appPath, 'images'), function(err) {
if ( err ) console.log('ERROR: ' + err);
});
},

}
}
});

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"url": "git://github.com/diegonetto/generator-ionic.git"
},
"scripts": {
"test": "mocha"
"test": "mocha --timeout 5000"
},
"dependencies": {
"chalk": "^0.5.1",
Expand Down
82 changes: 48 additions & 34 deletions test/test-creation.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,55 @@
/*global describe, beforeEach, it*/
/*global describe, it, beforeEach */
'use strict';

var path = require('path');
var path = require('path');
var helpers = require('yeoman-generator').test;

describe('Ionic Framework Generator', function () {
beforeEach(function (done) {
this.timeout(60000);
helpers.testDirectory(path.join(__dirname, 'temp'), function (err) {
if (err) {
return done(err);
}

this.app = helpers.createGenerator('ionic:app', [
'../../app'
]);
done();
}.bind(this));
});
describe('Ionic Generator', function () {

beforeEach(function (done) {

helpers
.testDirectory(path.join(__dirname, 'temp'), function (err) {
if (err) {
return done(err);
}
this.app = helpers.createGenerator(
'ionic:app', [
'../../app'
]);

done();
}.bind(this));
});

it('creates expected files', function () {

it('creates expected files', function (done) {
this.timeout(60000);
var expected = [
// add files you expect to exist here.
'.jshintrc',
'.editorconfig'
];

helpers.mockPrompt(this.app, {
compass: false,
plugins: ['com.ionic.keyboard'],
starter: 'Tabs'
});
this.app.init = function () {};
this.app.run({}, function () {
helpers.assertFiles(expected);
done();
});
var expected = [
'config.xml',
'www/index.html',
'www/js/index.js',
'.bowerrc',
'.editorconfig',
'.gitignore',
'.jshintrc',
'Gruntfile.js',
'package.json',
'bower.json'
];

helpers.mockPrompt(this.app, {
compass: false,
plugins: ['com.ionic.keyboard'],
starter: 'Tabs'
});

this.app.options['skip-install'] = false;

this.app.run({}, function () {
helpers.assertFile(expected);
done();
})

});
});

11 changes: 5 additions & 6 deletions test/test-load.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/*global describe, beforeEach, it*/
/*global describe, it, beforeEach */
'use strict';

var assert = require('assert');
var assert = require('yeoman-generator').assert;

describe('ionic generator', function () {
describe('Ionic Generator load test', function () {
it('can be imported without blowing up', function () {
var app = require('../app');
assert(app !== undefined);
assert(require('../app') !== undefined);
});
});
});

0 comments on commit 2249151

Please sign in to comment.