Skip to content

Commit 6f008f2

Browse files
committed
Merge pull request #9 from zckrs/use-generator-node
Use generator-node to manage this library
2 parents 31092e2 + 53998b0 commit 6f008f2

11 files changed

+92
-76
lines changed

.editorconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# editorconfig.org
21
root = true
32

43
[*]

.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
node_modules/
2-
temp/
3-
temp.dev/
4-
coverage/
1+
node_modules
2+
coverage

.jscsrc

Lines changed: 0 additions & 28 deletions
This file was deleted.

.jshintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.jshintrc

Lines changed: 0 additions & 17 deletions
This file was deleted.

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
sudo: false
22
language: node_js
33
node_js:
4-
- 'iojs'
4+
- v5
5+
- v4
56
- '0.12'
67
- '0.10'

readme.md renamed to README.md

File renamed without changes.

gulpfile.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
'use strict';
2+
var path = require('path');
3+
var gulp = require('gulp');
4+
var eslint = require('gulp-eslint');
5+
var excludeGitignore = require('gulp-exclude-gitignore');
6+
var mocha = require('gulp-mocha');
7+
var istanbul = require('gulp-istanbul');
8+
var nsp = require('gulp-nsp');
9+
var plumber = require('gulp-plumber');
10+
11+
gulp.task('static', function () {
12+
return gulp.src('**/*.js')
13+
.pipe(excludeGitignore())
14+
.pipe(eslint())
15+
.pipe(eslint.format())
16+
.pipe(eslint.failAfterError());
17+
});
18+
19+
gulp.task('nsp', function (cb) {
20+
nsp({package: path.resolve('package.json')}, cb);
21+
});
22+
23+
gulp.task('pre-test', function () {
24+
return gulp.src('**/*.js')
25+
.pipe(excludeGitignore())
26+
.pipe(istanbul({
27+
includeUntested: true
28+
}))
29+
.pipe(istanbul.hookRequire());
30+
});
31+
32+
gulp.task('test', ['pre-test'], function (cb) {
33+
var mochaErr;
34+
35+
gulp.src('test.js')
36+
.pipe(plumber())
37+
.pipe(mocha({reporter: 'spec'}))
38+
.on('error', function (err) {
39+
mochaErr = err;
40+
})
41+
.pipe(istanbul.writeReports())
42+
.on('end', function () {
43+
cb(mochaErr);
44+
});
45+
});
46+
47+
gulp.task('watch', function () {
48+
gulp.watch('**/*.js', ['test']);
49+
});
50+
51+
gulp.task('prepublish', ['nsp']);
52+
gulp.task('default', ['static', 'test']);

index.js

100755100644
File mode changed.

package.json

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,45 @@
22
"name": "yeoman-assert",
33
"version": "2.1.1",
44
"description": "Assert utility from yeoman",
5-
"license": "BSD",
5+
"homepage": "http://yeoman.io",
6+
"author": "The Yeoman Team",
7+
"files": [
8+
"index.js"
9+
],
10+
"main": "index.js",
611
"keywords": [
712
"assert",
813
"utility",
914
"helper",
1015
"yeoman"
1116
],
12-
"homepage": "http://yeoman.io",
13-
"author": "The Yeoman Team",
17+
"license": "BSD-2-Clause",
1418
"repository": "yeoman/yeoman-assert",
15-
"files": [
16-
"index.js"
17-
],
1819
"engines": {
1920
"node": ">=0.10.0"
2021
},
2122
"scripts": {
22-
"test": "jshint *.js && jscs *.js && mocha"
23+
"test": "gulp",
24+
"prepublish": "gulp prepublish"
2325
},
2426
"dependencies": {
2527
"lodash": "^3.6.0",
26-
"path-exists": "^1.0.0"
28+
"path-exists": "^2.1.0"
2729
},
2830
"devDependencies": {
29-
"jscs": "^1.12.0",
30-
"jshint": "^2.6.3",
31-
"mocha": "*"
31+
"eslint-config-xo-space": "^0.7.0",
32+
"gulp": "^3.9.0",
33+
"gulp-eslint": "^1.0.0",
34+
"gulp-exclude-gitignore": "^1.0.0",
35+
"gulp-istanbul": "^0.10.3",
36+
"gulp-mocha": "^2.0.0",
37+
"gulp-nsp": "^2.1.0",
38+
"gulp-plumber": "^1.0.0"
39+
},
40+
"eslintConfig": {
41+
"extends": "xo-space",
42+
"env": {
43+
"mocha": true
44+
}
3245
}
3346
}

test.js

100755100644
Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/*global it, describe, before, beforeEach */
21
'use strict';
32
var path = require('path');
43
var assert = require('assert');
@@ -123,7 +122,7 @@ describe('yeoman-assert', function () {
123122

124123
describe('.implement()', function () {
125124
beforeEach(function () {
126-
this.subject = { foo: noop, bar: noop };
125+
this.subject = {foo: noop, bar: noop};
127126
this.interfaceSome = ['foo'];
128127
this.interfaceComplete = ['foo', 'bar'];
129128
this.interfaceMore = ['foo', 'yo'];
@@ -139,21 +138,21 @@ describe('yeoman-assert', function () {
139138
});
140139

141140
it('allow interface to be an object (using its object.keys)', function () {
142-
var interfacePass = { foo: noop };
143-
var interfaceFail = { yop: noop };
141+
var interfacePass = {foo: noop};
142+
var interfaceFail = {yop: noop};
144143
assert.doesNotThrow(yoAssert.implement.bind(yoAssert, this.subject, interfacePass));
145144
assert.throws(yoAssert.implement.bind(yoAssert, this.subject, interfaceFail));
146145
});
147146

148147
it('when object is passed in, it only check it implements the methods', function () {
149-
var expected = { foo: noop, yop: 'some arg' };
148+
var expected = {foo: noop, yop: 'some arg'};
150149
assert.doesNotThrow(yoAssert.implement.bind(yoAssert, this.subject, expected));
151150
});
152151
});
153152

154153
describe('.notImplement()', function () {
155154
beforeEach(function () {
156-
this.subject = { foo: noop, bar: noop };
155+
this.subject = {foo: noop, bar: noop};
157156
this.interfaceSome = ['foo'];
158157
});
159158

@@ -177,18 +176,18 @@ describe('yeoman-assert', function () {
177176

178177
it('pass if object contains nested objects and arrays', function () {
179178
assert.doesNotThrow(yoAssert.objectContent.bind(yoAssert, {
180-
a: { b: 'foo' },
179+
a: {b: 'foo'},
181180
b: [0, 'a'],
182181
c: 'a'
183182
}, {
184-
a: { b: 'foo' },
183+
a: {b: 'foo'},
185184
b: [0, 'a']
186185
}));
187186
});
188187

189188
it('pass if array is incomplete', function () {
190189
assert.doesNotThrow(yoAssert.objectContent.bind(yoAssert, {
191-
b: [0, 'a'],
190+
b: [0, 'a']
192191
}, {
193192
b: [0]
194193
}));
@@ -204,7 +203,7 @@ describe('yeoman-assert', function () {
204203
assert.throws(yoAssert.objectContent.bind(yoAssert, {
205204
a: {}
206205
}, {
207-
a: { b: 'foo' }
206+
a: {b: 'foo'}
208207
}));
209208
});
210209
});
@@ -214,19 +213,19 @@ describe('yeoman-assert', function () {
214213

215214
it('pass if file contains the keys', function () {
216215
assert.doesNotThrow(yoAssert.jsonFileContent.bind(yoAssert, file, {
217-
a: { b: 1 },
216+
a: {b: 1},
218217
b: [1, 2]
219218
}));
220219
});
221220

222221
it('fails if file does not contain the keys', function () {
223222
assert.throws(yoAssert.jsonFileContent.bind(yoAssert, file, {
224-
a: { b: 1 },
223+
a: {b: 1},
225224
b: 'a'
226225
}));
227226

228227
assert.throws(yoAssert.jsonFileContent.bind(yoAssert, file, {
229-
a: { b: 3 },
228+
a: {b: 3},
230229
b: [1]
231230
}));
232231
});

0 commit comments

Comments
 (0)