Skip to content

Commit 7bdd728

Browse files
committed
Don't print domain objects in yaml
They're hella massive and blow up the terminal because of the huge "members" array that generally always contains at least one tap Test object.
1 parent 98106c5 commit 7bdd728

File tree

6 files changed

+63
-0
lines changed

6 files changed

+63
-0
lines changed

lib/clean-yaml-object.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var Module = require('module')
44
var fs = require('fs')
55
var binpath = path.resolve(__dirname, '../bin')
66
var stack = require('./stack.js')
7+
var Domain = require('domain').Domain
78

89
function hasOwn (obj, key) {
910
return Object.prototype.hasOwnProperty.call(obj, key)
@@ -36,6 +37,9 @@ function cleanTapYamlObject (object) {
3637
}
3738

3839
function yamlFilter (propertyName, isRoot, source, target) {
40+
if (source instanceof Domain)
41+
return false
42+
3943
if (!isRoot)
4044
return true
4145

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
TAP version 13
2+
not ok 1 - check ee matches ___/# time=[0-9.]+(ms)?/~~~ {
3+
not ok 1 - should match pattern provided
4+
---
5+
{"at":{"column":5,"file":"test/test/emitter-match.js","line":6},"found":{"_events":{},"_eventsCount":0,"_maxListeners":null,"domain":{},"truthy":false},"pattern":{"truthy":true},"source":"t.match(e, { truthy: true })\n"}
6+
...
7+
8+
Bail out! # should match pattern provided
9+
}
10+
Bail out! # should match pattern provided
11+

test/test/emitter-match--bail.tap

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
TAP version 13
2+
# Subtest: check ee matches
3+
not ok 1 - should match pattern provided
4+
---
5+
{"at":{"column":5,"file":"test/test/emitter-match.js","line":6},"found":{"_events":{},"_eventsCount":0,"_maxListeners":null,"domain":{},"truthy":false},"pattern":{"truthy":true},"source":"t.match(e, { truthy: true })\n"}
6+
...
7+
8+
Bail out! # should match pattern provided
9+
Bail out! # should match pattern provided
10+

test/test/emitter-match--buffer.tap

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
TAP version 13
2+
not ok 1 - check ee matches ___/# time=[0-9.]+(ms)?/~~~ {
3+
not ok 1 - should match pattern provided
4+
---
5+
{"at":{"column":5,"file":"test/test/emitter-match.js","line":6},"found":{"_events":{},"_eventsCount":0,"_maxListeners":null,"domain":{},"truthy":false},"pattern":{"truthy":true},"source":"t.match(e, { truthy: true })\n"}
6+
...
7+
8+
1..1
9+
# failed 1 test
10+
}
11+
12+
1..1
13+
# failed 1 test
14+
___/# time=[0-9.]+(ms)?/~~~
15+

test/test/emitter-match.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
var t = require('../..')
2+
var EE = require('events').EventEmitter
3+
t.test('check ee matches', function (t) {
4+
var e = new EE()
5+
e.truthy = false
6+
t.match(e, { truthy: true })
7+
t.end()
8+
})

test/test/emitter-match.tap

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
TAP version 13
2+
# Subtest: check ee matches
3+
not ok 1 - should match pattern provided
4+
---
5+
{"at":{"column":5,"file":"test/test/emitter-match.js","line":6},"found":{"_events":{},"_eventsCount":0,"_maxListeners":null,"domain":{},"truthy":false},"pattern":{"truthy":true},"source":"t.match(e, { truthy: true })\n"}
6+
...
7+
8+
1..1
9+
# failed 1 test
10+
not ok 1 - check ee matches ___/# time=[0-9.]+(ms)?/~~~
11+
12+
1..1
13+
# failed 1 test
14+
___/# time=[0-9.]+(ms)?/~~~
15+

0 commit comments

Comments
 (0)