Skip to content

Commit 7b63cb2

Browse files
author
Shinigami
authoredMay 19, 2020
fix: correctly call hint queue drain (#409)
* fix: correctly call hint queue drain * chore: check stdout output
1 parent 3899188 commit 7b63cb2

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed
 

‎bin/htmlhint

+2-2
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,10 @@ function hintAllFiles(target, options, onFinised) {
248248
// start hint
249249
var isWalkDone = false
250250
var isHintDone = true
251-
hintQueue.drain = function () {
251+
hintQueue.drain(() => {
252252
isHintDone = true
253253
checkAllHinted()
254-
}
254+
})
255255

256256
function checkAllHinted() {
257257
if (isWalkDone && isHintDone) {

‎test/executable.spec.js

+30
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,34 @@ describe('Executable', () => {
3636
expect(stdoutEnd || processEnd).to.be(false)
3737
})
3838
})
39+
40+
for (const format of [
41+
'checkstyle',
42+
'compact',
43+
'default',
44+
'html',
45+
'json',
46+
'junit',
47+
'markdown',
48+
'unix',
49+
]) {
50+
it(`should have stdout output with formatter ${format}`, (done) => {
51+
ChildProcess.exec(
52+
[
53+
'node',
54+
path.resolve(__dirname, '../bin/htmlhint'),
55+
path.resolve(__dirname, './html/executable.html'),
56+
'--format',
57+
'json',
58+
].join(' '),
59+
(error, stdout, stderr) => {
60+
expect(error).to.be.an('object')
61+
expect(error.code).to.be.equal(1)
62+
expect(stdout).not.to.be.equal('')
63+
expect(stderr).to.be.equal('')
64+
done()
65+
}
66+
)
67+
})
68+
}
3969
})

0 commit comments

Comments
 (0)
Please sign in to comment.