Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

abstract-winston-transport

winstonjs1.3kMIT0.5.1

An abstract test suite for winston inspired by abstract-blob-store

winston, transport

readme

Abstract Winston Transport

A set of mocha-based tests for ensuring that a given Transport (written for winston >= 3) is compatible with the expected APIs.

Inspired by https://github.com/maxogden/abstract-blob-store

Usage

test/your-transport.test.js

require('abstract-winston-transport')({
  name: 'YourTransport',
  Transport: require('../path/to/your/transport')
});

Sample usage from winston/test/transports/console.test.js

require('abstract-winston-transport')({
  name: 'Console',
  Transport: winston.transports.Console
});

Passing in custom options to your TransportStream

If your custom TransportStream requires more options on construction than a default TransportStream they can be provided via the construct option:

test/your-transport.test.js

require('abstract-winston-transport')({
  name: 'YourTransport',
  Transport: require('../path/to/your/transport'),
  construct: {
    anyRequired: 'value-for-transport',
    anythingReally: 'depends-on-what-you-need'
  }
  //
  // "construct" can also be a function that returns
  // options if that's something you need
  //
  construct: function () {
    return {
      willBe: 'called-before'
      every: 'test'
    };
  }
});

Turning on additional query and stream test suites

There are additional suites for query and stream interfaces expected to be exposed on a winston Transport (i.e. a TransportStream). You can enable these by setting the options to true:

test/your-transport.test.js

require('abstract-winston-transport')({
  name: 'YourTransport',
  Transport: require('../path/to/your/transport'),
  query: true,
  stream: true
});
Author: Charlie Robbins
LICENSE: MIT

changelog

CHANGELOG

0.5.1

2017/10/01
  • Allow for info messages to be emitted from logged events.

0.5.0

2017/09/30
  • Accept after and afterEach in options.

0.4.0

2017/09/30
  • Migrate support to info[MESSAGE].

0.3.0

2017/09/29
  • Add support for the LEVEL Symbol.

0.1.0

2017/03/19
  • Initial release