Skip to content

Commit acfebc3

Browse files
anthony-redFoxtmcw
authored andcommitted
chore: Fixed tests and Update all dependencies (#43)
* Fixed unit tests after updated documentation.js on new version * All tests in test.js file and not necessary include all folder. * Add gitignore for node_modules folder. * Prettier index.js file * Update all dependencies * Replaced function on arrow func for Foreach and use a chain of promises
1 parent 25669e9 commit acfebc3

File tree

4 files changed

+40
-41
lines changed

4 files changed

+40
-41
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

lib/index.js

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -86,35 +86,29 @@ module.exports = function(format, options, formatterOptions) {
8686
cb();
8787
},
8888
function(cb) {
89-
documentation.build(
90-
files.map(function(file) {
91-
return file.path;
92-
}),
93-
options,
94-
function(err, comments) {
95-
formatter(
96-
comments,
97-
formatterOptions,
98-
function(err, output) {
99-
if (format === 'json' || format === 'md') {
100-
this.push(
101-
new File({
102-
path: options.filename || 'API.' + format,
103-
contents: new Buffer(output)
104-
})
105-
);
106-
} else if (format === 'html') {
107-
output.forEach(
108-
function(file) {
109-
this.push(file);
110-
}.bind(this)
111-
);
112-
}
113-
cb();
114-
}.bind(this)
115-
);
116-
}.bind(this)
117-
);
89+
documentation
90+
.build(
91+
files.map(function(file) {
92+
return file.path;
93+
}),
94+
options
95+
)
96+
.then(comments => {
97+
return formatter(comments, formatterOptions);
98+
})
99+
.then(output => {
100+
if (format === 'json' || format === 'md') {
101+
this.push(
102+
new File({
103+
path: options.filename || 'API.' + format,
104+
contents: new Buffer(output)
105+
})
106+
);
107+
} else if (format === 'html') {
108+
output.forEach(file => this.push(file));
109+
}
110+
cb();
111+
});
118112
}
119113
);
120114
};

package.json

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,23 @@
44
"version": "3.2.0",
55
"author": "Tom MacWright",
66
"dependencies": {
7-
"documentation": "4.0.0-rc.0",
8-
"through2": "^2.0.1",
9-
"vinyl": "^2.0.0"
7+
"through2": "^2.0.3",
8+
"vinyl": "^2.1.0"
9+
},
10+
"peerDependencies": {
11+
"documentation": ">=4.0.0",
12+
"gulp": ">=3.0.0"
1013
},
1114
"devDependencies": {
12-
"concat-stream": "^1.4.8",
15+
"documentation": "^5.1.1",
16+
"gulp": "^3.9.1",
17+
"concat-stream": "^1.6.0",
1318
"cz-conventional-changelog": "^2.0.0",
14-
"gulp": "^3.8.11",
15-
"husky": "^0.13.3",
16-
"lint-staged": "^3.4.0",
17-
"prettier": "^1.0.0",
18-
"standard-version": "^4.0.0",
19-
"tap": "10.3.4"
19+
"husky": "^0.14.3",
20+
"lint-staged": "^4.0.3",
21+
"prettier": "^1.5.3",
22+
"standard-version": "^4.2.0",
23+
"tap": "10.7.1"
2024
},
2125
"keywords": [
2226
"documentation",
@@ -35,7 +39,7 @@
3539
"precommit": "lint-staged --verbose",
3640
"format": "prettier --write '{lib,test}/**/*.js' --single-quote",
3741
"docs": "documentation readme index.js --section=API",
38-
"test": "tap test"
42+
"test": "tap test/test.js"
3943
},
4044
"config": {
4145
"commitizen": {

test/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ test('gulp-documentation html', function(t) {
4545
.pipe(documentation('html'))
4646
.pipe(
4747
concat(function(d) {
48-
t.equal(d.length, 34);
48+
t.ok(d.length === 34 || d.length === 36);
4949
t.end();
5050
})
5151
);

0 commit comments

Comments
 (0)