857814
commit 5e7484daa56a7932b6d1bf7c00474d55c20420da
857814
Author: Tom Hughes <tom@compton.nu>
857814
Date:   Thu Mar 31 16:05:12 2016 +0100
857814
857814
    Fix tests for Node.js 5
857814
    
857814
    As it is the compressed stream that is truncated, it is the gunzip
857814
    stream that reports the end of file error now.
857814
857814
diff --git a/.travis.yml b/.travis.yml
857814
index fca8ef0..e2c1d11 100644
857814
--- a/.travis.yml
857814
+++ b/.travis.yml
857814
@@ -2,3 +2,5 @@ language: node_js
857814
 node_js:
857814
   - 0.10
857814
   - 0.11
857814
+  - 4
857814
+  - 5
857814
diff --git a/test/error-on-broken.js b/test/error-on-broken.js
857814
index e484920..7bc82c6 100644
857814
--- a/test/error-on-broken.js
857814
+++ b/test/error-on-broken.js
857814
@@ -18,8 +18,14 @@ tap.test('preclean', function (t) {
857814
 tap.test('extract test', function (t) {
857814
   var extract = tar.Extract(target)
857814
   var inp = fs.createReadStream(file)
857814
+  var gunzip = inp.pipe(zlib.createGunzip())
857814
 
857814
-  inp.pipe(zlib.createGunzip()).pipe(extract)
857814
+  gunzip.pipe(extract)
857814
+
857814
+  gunzip.on('error', function (er) {
857814
+    t.equal(er.message, 'unexpected end of file')
857814
+    t.end()
857814
+  })
857814
 
857814
   extract.on('error', function (er) {
857814
     t.equal(er.message, 'unexpected eof', 'error noticed')