module.exports = {
    name: 'unexpected-stream',
    version: require('../package.json').version,
    installInto: function (expect) {
        expect.addType({
            name: 'Stream',
            base: 'object',
            inspect: function (obj, depth, output, inspect) {
                return output.text(obj.constructor.name, 'jsFunctionName');
            },
            identify: function (obj) {
                return obj && typeof obj.on === 'function' && (obj._readableState || typeof obj.readable === 'boolean' || typeof obj.writable === 'boolean');
            }
        });

        expect.addAssertion(['Stream', 'string', 'Buffer', 'array'], 'when piped through', function (expect, subject, value) {
            this.errorMode = 'nested';

            var extraArgs = Array.prototype.slice.call(arguments, 3);
            return expect.promise(function (resolve, reject) {
                var pipeThroughStreams = Array.isArray(value) ? value : [ value ];
                var subjectType = expect.findTypeOf(subject);
                var result;
                if (subjectType.is('Stream')) {
                    result = subject;
                    subject.on('error', reject);
                } else {
                    // string, Buffer, or array
                    (Array.isArray(subject) ? subject : [ subject ]).forEach(function (chunk) {
                        pipeThroughStreams[0].write(chunk);
                    });
                    pipeThroughStreams[0].end();
                }

                pipeThroughStreams.forEach(function (pipeThroughStream) {
                    pipeThroughStream.on('error', reject);
                    result = result ? result.pipe(pipeThroughStream) : pipeThroughStream;
                });

                return resolve(expect.apply(expect, [result, 'to satisfy assertion'].concat(extraArgs)));
            });
        });

        expect.addAssertion('Stream', 'to yield (output|chunks|objects) satisfying', function (expect, subject) {
            this.errorMode = 'nested';

            var extraArgs = Array.prototype.slice.call(arguments, 2),
                mustConcat = this.alternations[0] === 'output';

            return expect.promise(function (resolve, reject) {
                if (!subject._unexpectedStreamChunksPromise) {
                    subject._unexpectedStreamChunksPromise = expect.promise(function (resolve, reject) {
                        expect(subject, 'to have property', 'readable', true);
                        var chunks = [];
                        subject.on('data', function (chunk) {
                            chunks.push(chunk);
                        }).on('end', function () {
                            resolve(chunks);
                        }).on('error', reject);
                    });
                }
                subject._unexpectedStreamChunksPromise.then(function (chunks) {
                    var result;
                    if (mustConcat) {
                        if (chunks.length > 0 && chunks.every(function (chunk) { return typeof chunk === 'string'; })) {
                            result = chunks.join('');
                        } else {
                            // chunks or objects (object mode)
                            result = Buffer.concat(chunks.map(function (chunk) {
                                if (typeof chunk === 'string') {
                                    return new Buffer(chunk, 'utf-8');
                                } else {
                                    return chunk;
                                }
                            }));
                        }
                    } else {
                        result = chunks;
                    }
                    resolve(result);
                });
            }).then(function (result) {
                return expect.apply(expect, [result, 'to satisfy assertion'].concat(extraArgs));
            });
        });
    }
};

@@ -619,50 +619,38 @@
 ion(
-%5B
 '
+%3C
 Stream
-', '
+%7C
 string
-', '
+%7C
 Buffer
-', '
+%7C
 array
-'%5D, '
+%3E 
 when
@@ -663,16 +663,38 @@
  through
+ %3Carray%7CStream%3E %3Cany+%3E
 ', funct
@@ -728,36 +728,38 @@
 ) %7B%0A            
-this
+expect
 .errorMode = 'ne
@@ -1940,18 +1940,17 @@
 on('
+%3C
 Stream
-', '
+%3E 
 to y
@@ -1988,16 +1988,23 @@
 tisfying
+ %3Cany+%3E
 ', funct
@@ -2039,20 +2039,22 @@
         
-this
+expect
 .errorMo
@@ -2172,12 +2172,14 @@
 t = 
-this
+expect
 .alt

Use the new v10 type syntax.