-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.js
28 lines (27 loc) · 1.17 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
* Winston TransportStream Abstract Test Suite
*
* @param {Object} opts Options for your test suite execution
* @param {String} opts.name Transport name.
* @param {TransportStream} opts.Transport Class to instantiate (new Transport).
* @param {Boolean} opts.query If true, will also include "Query" suite.
* @param {Boolean} opts.stream If true, will also include "Stream" suite.
* @param {Object} opts.construct Options to pass to the transport to instantiate.
* - If passed an object, it will be passed as is when calling `new Transport(options)`.
* - If passed a function it will be called before: `new Transport(options())`.
* - If parameter left empty defaults to {}.
*/
module.exports = function (options) {
if (!options || !options.name || !options.Transport) {
throw new Error('name and Transport are required options');
}
var name = options.name;
describe(name + ' transport (abstract-winston-tranport)', function () {
require('./log')(options);
['stream', 'query'].forEach(function (suite) {
if (options[suite]) {
require('./' + suite)(options);
}
});
});
};