Skip to content

Commit 173d0ef

Browse files
authored
Merge pull request #22 from sfriesel/fix-browser-test
Fix browser-test
2 parents 81cd5f6 + 6e701e3 commit 173d0ef

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
],
1414
"scripts": {
1515
"prepare": "mkdir -p dist && browserify -s unbzip2Stream index.js | uglifyjs > dist/unbzip2-stream.min.js",
16-
"browser-test": "browserify -t brfs test/simple.js | tape-run2 -b phantomjs",
16+
"browser-test": "browserify -t brfs test/simple.js | tape-run",
1717
"prepare-long-test": "dd if=/dev/urandom of=test/fixtures/vmlinux.bin bs=50x1024x1024 count=2 && cat test/fixtures/vmlinux.bin | bzip2 > test/fixtures/vmlinux.bin.bz2",
1818
"long-test": "tape test/extra/long.js",
1919
"download-test": "beefy test/browser/long.js --open -- -t brfs",
@@ -39,7 +39,7 @@
3939
"browserify": "^8.1.0",
4040
"concat-stream": "^1.4.7",
4141
"tape": "^3.4.0",
42-
"tape-run2": "^1.0.3",
42+
"tape-run": "^4.0.0",
4343
"throughout": "0.0.0",
4444
"uglify-js": "^3.0.10"
4545
},

test/simple.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,15 @@ test('should emit error when stream is broken in a different way?', function(t)
6969
t.plan(1);
7070
// this is the smallest truncated file I found that reproduced the bug, but
7171
// longer files will also work.
72-
var truncated = 'test/fixtures/truncated.bz2';
72+
var truncated = fs.readFileSync('test/fixtures/brokencrc.bz2');
73+
var unbz2 = unbzip2Stream();
74+
unbz2.on('error', function (err) {
75+
t.ok(true, err);
76+
});
77+
unbz2.on('close', function (err) {
78+
t.ok(false, "Should not reach end of stream without failing.");
79+
});
7380

74-
fs.createReadStream(truncated).
75-
on('error', function (err) {
76-
t.ok(false, "The file stream itself should not be failing.");
77-
}).
78-
pipe(unbzip2Stream()).
79-
on('error', function (err) {
80-
t.ok(true, err);
81-
}).
82-
on('close', function (err) {
83-
t.ok(false, "Should not reach end of stream without failing.");
84-
});
81+
unbz2.write(truncated);
82+
unbz2.end();
8583
});

0 commit comments

Comments
 (0)