Skip to content

Commit a5edbcd

Browse files
committed
fix test framework options when scaffolding with existing project
1 parent 18c4c31 commit a5edbcd

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

Diff for: Gruntfile.js

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ module.exports = function (grunt) {
139139
bootstrap: true,
140140
uibootstrap: true,
141141
mongoose: true,
142+
testing: 'jasmine',
142143
auth: true,
143144
oauth: ['googleAuth', 'twitterAuth'],
144145
socketio: true

Diff for: app/index.js

+19-8
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,23 @@ var AngularFullstackGenerator = yeoman.generators.Base.extend({
5252
}], function (answers) {
5353
this.skipConfig = answers.skipConfig;
5454

55+
this.filters = this._.defaults(this.config.get('filters'), {
56+
bootstrap: true,
57+
uibootstrap: true,
58+
jasmine: true
59+
});
60+
5561
// NOTE: temp(?) fix for #403
56-
if(typeof this.oauth==='undefined') {
62+
if(typeof this.filters.oauth==='undefined') {
5763
var strategies = Object.keys(this.filters).filter(function(key) {
5864
return key.match(/Auth$/) && key;
5965
});
6066

61-
if(strategies.length) this.config.set('oauth', true);
67+
if(strategies.length) this.filters.oauth = true;
6268
}
6369

70+
this.config.forceSave();
71+
6472
cb();
6573
}.bind(this));
6674
} else {
@@ -228,9 +236,17 @@ var AngularFullstackGenerator = yeoman.generators.Base.extend({
228236
}
229237
}], function (answers) {
230238
this.filters[answers.testing] = true;
231-
if (this.filters.mocha) {
239+
if (answers.testing === 'mocha') {
240+
this.filters.jasmine = false;
241+
this.filters.should = false;
242+
this.filters.expect = false;
232243
this.filters[answers.chai] = true;
233244
}
245+
if (answers.testing === 'jasmine') {
246+
this.filters.mocha = false;
247+
this.filters.should = false;
248+
this.filters.expect = false;
249+
}
234250

235251
cb();
236252
}.bind(this));
@@ -289,11 +305,6 @@ var AngularFullstackGenerator = yeoman.generators.Base.extend({
289305
},
290306

291307
ngModules: function() {
292-
this.filters = this._.defaults(this.config.get('filters'), {
293-
bootstrap: true,
294-
uibootstrap: true
295-
});
296-
297308
var angModules = [
298309
"'ngCookies'",
299310
"'ngResource'",

0 commit comments

Comments
 (0)