stream-output

Get the result of a streams transform pipeline for your tests

Usage no npm install needed!

<script type="module">
  import streamOutput from 'https://cdn.skypack.dev/stream-output';
</script>

README

stream-output

Get the result of stream output for your tests

There's no way this doesn't already exist, but I can't find what I'm looking for on npm.

I use transform streams for flow control/validation/mutation. I needed a clean way to run assertions on the end result during unit tests.

var output = require('stream-output/obj');

describe('Testing a set of transforms', function () {
  it('Does some shiz', function (done) {
    var test = function (data) {
      expect(data).to.have.deep.property('foo','bar');
      done();
    }
    SomeObjModeStream.pipe(someTransform).pipe(output(test));
  }
});