-
-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Child tests should inherit bail-on-fail from parent
Unless explicitly specified in options object.
- Loading branch information
Showing
2 changed files
with
9 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,27 @@ | ||
var t = require('../') | ||
var Test = t.Test | ||
|
||
var tt = new Test() | ||
var tt = new Test({ bail: false }) | ||
tt._name = 'one' | ||
tt.pass('this is fine') | ||
tt.end() | ||
t.throws(function () { | ||
tt.threw(new Error('whoops')) | ||
}, { message: 'whoops', stack: /^Error: whoops\n/ }) | ||
|
||
var out = '' | ||
tt = new Test() | ||
tt = new Test({ bail: false }) | ||
tt._name = 'two' | ||
|
||
tt.on('data', function (c) { | ||
out += c | ||
}) | ||
tt.test(function (tt) { | ||
tt.test('child', function (tt) { | ||
tt.threw(new Error('whoops')) | ||
tt.end() | ||
}) | ||
tt.end() | ||
|
||
t.match(out, '\n not ok 1 - Error: whoops\n') | ||
t.match(out, '\n tt.threw(new Error(\'whoops\'))\n') | ||
t.match(out, '\nnot ok 1 - (unnamed test) # time=') | ||
t.match(out, '\nnot ok 1 - child # time=') |