Skip to content

Commit

Permalink
Don't print domain objects in yaml
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
isaacs committed Apr 9, 2017
1 parent 98106c5 commit 7bdd728
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/clean-yaml-object.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var Module = require('module')
var fs = require('fs')
var binpath = path.resolve(__dirname, '../bin')
var stack = require('./stack.js')
var Domain = require('domain').Domain

function hasOwn (obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key)
Expand Down Expand Up @@ -36,6 +37,9 @@ function cleanTapYamlObject (object) {
}

function yamlFilter (propertyName, isRoot, source, target) {
if (source instanceof Domain)
return false

if (!isRoot)
return true

Expand Down
11 changes: 11 additions & 0 deletions test/test/emitter-match--bail--buffer.tap
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
TAP version 13
not ok 1 - check ee matches ___/# time=[0-9.]+(ms)?/~~~ {
not ok 1 - should match pattern provided
---
{"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"}
...

Bail out! # should match pattern provided
}
Bail out! # should match pattern provided

10 changes: 10 additions & 0 deletions test/test/emitter-match--bail.tap
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
TAP version 13
# Subtest: check ee matches
not ok 1 - should match pattern provided
---
{"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"}
...

Bail out! # should match pattern provided
Bail out! # should match pattern provided

15 changes: 15 additions & 0 deletions test/test/emitter-match--buffer.tap
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
TAP version 13
not ok 1 - check ee matches ___/# time=[0-9.]+(ms)?/~~~ {
not ok 1 - should match pattern provided
---
{"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"}
...

1..1
# failed 1 test
}

1..1
# failed 1 test
___/# time=[0-9.]+(ms)?/~~~

8 changes: 8 additions & 0 deletions test/test/emitter-match.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var t = require('../..')
var EE = require('events').EventEmitter
t.test('check ee matches', function (t) {
var e = new EE()
e.truthy = false
t.match(e, { truthy: true })
t.end()
})
15 changes: 15 additions & 0 deletions test/test/emitter-match.tap
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
TAP version 13
# Subtest: check ee matches
not ok 1 - should match pattern provided
---
{"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"}
...

1..1
# failed 1 test
not ok 1 - check ee matches ___/# time=[0-9.]+(ms)?/~~~

1..1
# failed 1 test
___/# time=[0-9.]+(ms)?/~~~

0 comments on commit 7bdd728

Please sign in to comment.