diff --git a/.travis.yml b/.travis.yml index c7563df27..3e64255aa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,15 +4,17 @@ language: node_js node_js: - "0.10" - "0.12" - - "4.1" - + - "4.x" + - "5.x" + - "6.x" + cache: directories: - node_modules matrix: fast_finish: true - + script: "grunt" -after_success: istanbul-coveralls \ No newline at end of file +after_success: istanbul-coveralls diff --git a/test/executable.spec.js b/test/executable.spec.js new file mode 100644 index 000000000..7a0e4cadb --- /dev/null +++ b/test/executable.spec.js @@ -0,0 +1,34 @@ +var expect = require('expect.js'); + +var ChildProcess = require('child_process'); +var path = require('path'); + +describe('Executable', function () { + it('should close stream before exit', function (done) { + var c = ChildProcess.spawn('node', [path.resolve(__dirname,'../bin/htmlhint'), '--format', 'json', path.resolve(__dirname,'./html/executable.html')]); + var stdoutEnd = false; + var processEnd = false; + var isDone = 0; + + function checkDone() { + isDone++; + if (isDone == 2) { + done(); + } + } + + c.stdout.on('close', function() { + stdoutEnd = true; + checkDone(); + }); + + c.on('exit', function() { + processEnd = true; + checkDone(); + }); + + c.stdout.on('data', function() { + expect(stdoutEnd || processEnd).to.be(false); + }); + }); +}); diff --git a/test/html/executable.html b/test/html/executable.html new file mode 100644 index 000000000..8252a910c --- /dev/null +++ b/test/html/executable.html @@ -0,0 +1,99 @@ + + + + + Document + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ +
+ + + + + + +
+
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + +