Skip to content

Commit

Permalink
fix: correctly call hint queue drain (#409)
Browse files Browse the repository at this point in the history
* fix: correctly call hint queue drain

* chore: check stdout output
  • Loading branch information
Shinigami authored May 19, 2020
1 parent 3899188 commit 7b63cb2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/htmlhint
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,10 @@ function hintAllFiles(target, options, onFinised) {
// start hint
var isWalkDone = false
var isHintDone = true
hintQueue.drain = function () {
hintQueue.drain(() => {
isHintDone = true
checkAllHinted()
}
})

function checkAllHinted() {
if (isWalkDone && isHintDone) {
Expand Down
30 changes: 30 additions & 0 deletions test/executable.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,34 @@ describe('Executable', () => {
expect(stdoutEnd || processEnd).to.be(false)
})
})

for (const format of [
'checkstyle',
'compact',
'default',
'html',
'json',
'junit',
'markdown',
'unix',
]) {
it(`should have stdout output with formatter ${format}`, (done) => {
ChildProcess.exec(
[
'node',
path.resolve(__dirname, '../bin/htmlhint'),
path.resolve(__dirname, './html/executable.html'),
'--format',
'json',
].join(' '),
(error, stdout, stderr) => {
expect(error).to.be.an('object')
expect(error.code).to.be.equal(1)
expect(stdout).not.to.be.equal('')
expect(stderr).to.be.equal('')
done()
}
)
})
}
})

0 comments on commit 7b63cb2

Please sign in to comment.