Migrate _stream_readable errors to internal/errors by benhalverson · Pull Request #15042 · nodejs/node (original) (raw)
I could use some assistance on this test...
current test
function pushError() {
assert.throws(function() {
r.push(Buffer.allocUnsafe(1));
}, /^ERR_STREAM_PUSH_AFTER_EOF/);
}
What I have tried so far:
function pushError() {
common.expectsError({
code: 'ERR_STREAM_PUSH_AFTER_EOF',
message: 'stream.push() after EOF'
});
}
This gives the following error.
Path: parallel/test-stream-unshift-read-race
ok
events.js:182
throw er; // Unhandled 'error' event
^
Error: stream.push() after EOF
at readableAddChunk (_stream_readable.js:243:30)
at Readable.push (_stream_readable.js:211:10)
at pushError (/Users/benhalverson/projects/node/test/parallel/test-stream-unshift-read-race.js:77:9)
at Timeout._onTimeout (/Users/benhalverson/projects/node/test/parallel/test-stream-unshift-read-race.js:64:25)
at ontimeout (timers.js:471:11)
at tryOnTimeout (timers.js:305:5)
at Timer.listOnTimeout (timers.js:265:5)
Without r.push(Buffer.allocUnsafe(1));
I get this error.
Path: parallel/test-stream-unshift-read-race
Mismatched <anonymous> function calls. Expected exactly 1, actual 0.
at Object.exports.mustCall (/Users/benhalverson/projects/node/test/common/index.js:482:10)
at Object.expectsError (/Users/benhalverson/projects/node/test/common/index.js:707:27)
at pushError (/Users/benhalverson/projects/node/test/parallel/test-stream-unshift-read-race.js:78:14)
at Timeout._onTimeout (/Users/benhalverson/projects/node/test/parallel/test-stream-unshift-read-race.js:64:25)
at ontimeout (timers.js:471:11)
at tryOnTimeout (timers.js:305:5)
at Timer.listOnTimeout (timers.js:265:5)
0: asdfasdfas
1: 1234dfasdf
2: 1234asdfas
3: 1234dfasdf
4: 1234asdfas
5: 1234dfasdf
6: 1234asdfas
7: 1234dfasdf
8: 1234asdfas
9: 1234dfasdf
a: 1234asdfas
b: 1234dfasdf
c: 1234asdfas
d: 1234dfasdf
e: 1234asdfas
f: 1234dfasdf
g: 1234asdfa
h: 1234