Skip to content
This repository was archived by the owner on Apr 24, 2019. It is now read-only.

Commit c80365c

Browse files
author
Kahlil Lechelt
committed
Fix JSHint warnings and use --force to test init:module.
1 parent 8261250 commit c80365c

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

module/index.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ var ModuleGenerator = module.exports = function ModuleGenerator() {
1010

1111
util.inherits(ModuleGenerator, yeoman.generators.NamedBase);
1212

13-
ModuleGenerator.prototype.getAuthor = function getAuthor(){
13+
ModuleGenerator.prototype.getAuthor = function getAuthor() {
1414
this.author = this.readFileAsString('AUTHORS');
1515
};
1616

17-
ModuleGenerator.prototype.date = function date(){
17+
ModuleGenerator.prototype.date = function date() {
1818
var d = new Date();
1919
this.date = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate();
20-
}
20+
};
2121

2222
ModuleGenerator.prototype.module = function module() {
2323
this.copy('module.js', 'js/modules/' + this.name + '.js');
@@ -28,7 +28,6 @@ ModuleGenerator.prototype.test = function test() {
2828
};
2929

3030
ModuleGenerator.prototype.loadSpecs = function loadSpecs() {
31-
var specsToLoad, specFileContent, specTpl;
3231
var specs = [];
3332
var specsPath = path.join(process.cwd(), 'test/specs');
3433

@@ -37,11 +36,7 @@ ModuleGenerator.prototype.loadSpecs = function loadSpecs() {
3736
specs = specs.map(function cutFileending(specFile) {
3837
return specFile.replace('.js', '');
3938
});
40-
specsToLoad = '"' + specs.join('", "') + '"';
41-
specTpl = path.join(this.sourceRoot(), 'spec.js');
42-
specFileContent = this.readFileAsString(specTpl);
43-
specFileContent = specFileContent.replace('<%= specs %>', specsToLoad);
44-
45-
this.write(path.join(process.cwd(), 'test/spec.js'), specFileContent);
39+
this.specs = '"' + specs.join('", "') + '"';
40+
this.template(path.join(this.sourceRoot(), 'spec.js'), 'test/spec.js');
4641
}
4742
};

test/test.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*global describe, beforeEach, it*/
22
'use strict';
33

4-
var path = require('path');
4+
var path = require('path');
55
var helpers = require('yeoman-generator').test;
6-
var assert = require('assert');
6+
var assert = require('assert');
77

88
var expected = [
99

@@ -198,11 +198,16 @@ describe('module sub-generator', function () {
198198

199199
it('creates expected files for the module sub-generator', function (done) {
200200

201-
this.app = helpers.createGenerator('init:module', ['../../module'], ['test']);
201+
var deps = ['../../module'];
202+
var args = ['test'];
203+
var opts = { 'force': true };
204+
205+
this.app = helpers.createGenerator('init:module', deps, args, opts);
202206

203207
var expected = [
204208
'js/modules/test.js',
205-
'test/specs/test.spec.js'
209+
'test/specs/test.spec.js',
210+
'test/spec.js'
206211
];
207212

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

0 commit comments

Comments
 (0)