Blob Blame Raw
commit 5e7484daa56a7932b6d1bf7c00474d55c20420da
Author: Tom Hughes <tom@compton.nu>
Date:   Thu Mar 31 16:05:12 2016 +0100

    Fix tests for Node.js 5
    
    As it is the compressed stream that is truncated, it is the gunzip
    stream that reports the end of file error now.

diff --git a/.travis.yml b/.travis.yml
index fca8ef0..e2c1d11 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,3 +2,5 @@ language: node_js
 node_js:
   - 0.10
   - 0.11
+  - 4
+  - 5
diff --git a/test/error-on-broken.js b/test/error-on-broken.js
index e484920..7bc82c6 100644
--- a/test/error-on-broken.js
+++ b/test/error-on-broken.js
@@ -18,8 +18,14 @@ tap.test('preclean', function (t) {
 tap.test('extract test', function (t) {
   var extract = tar.Extract(target)
   var inp = fs.createReadStream(file)
+  var gunzip = inp.pipe(zlib.createGunzip())
 
-  inp.pipe(zlib.createGunzip()).pipe(extract)
+  gunzip.pipe(extract)
+
+  gunzip.on('error', function (er) {
+    t.equal(er.message, 'unexpected end of file')
+    t.end()
+  })
 
   extract.on('error', function (er) {
     t.equal(er.message, 'unexpected eof', 'error noticed')