1 | 'use strict';
|
2 |
|
3 | var tap = require('tap');
|
4 | var tape = require('../');
|
5 | var through = require('through');
|
6 |
|
7 | tap.test('test.comment() in objectMode', function (assert) {
|
8 | var printer = through({ objectMode: true });
|
9 | var objects = [];
|
10 | printer.on('error', function (e) {
|
11 | assert.fail(e);
|
12 | });
|
13 |
|
14 | printer.write = function (obj) {
|
15 | objects.push(obj);
|
16 | };
|
17 | printer.end = function (obj) {
|
18 | if (obj) { objects.push(obj); }
|
19 |
|
20 | assert.equal(objects.length, 3);
|
21 | assert.deepEqual(objects, [
|
22 | {
|
23 | type: 'test',
|
24 | name: 'test.comment',
|
25 | id: 0,
|
26 | skip: false,
|
27 | todo: false
|
28 | },
|
29 | 'message',
|
30 | { type: 'end', test: 0 }
|
31 | ]);
|
32 | assert.end();
|
33 | };
|
34 |
|
35 | tape.createStream({ objectMode: true }).pipe(printer);
|
36 |
|
37 | tape('test.comment', function (test) {
|
38 | test.comment('message');
|
39 | test.end();
|
40 | });
|
41 | });
|