simpler casper error handling in tests
Showing
1 changed file
with
4 additions
and
9 deletions
... | @@ -143,16 +143,11 @@ var Tester = function Tester(casper, options) { | ... | @@ -143,16 +143,11 @@ var Tester = function Tester(casper, options) { |
143 | 143 | ||
144 | // casper events | 144 | // casper events |
145 | this.casper.on('error', function onCasperError(msg, backtrace) { | 145 | this.casper.on('error', function onCasperError(msg, backtrace) { |
146 | var type = 'error', message = msg, match = /^(\w+)Error: (.*)/.exec(msg); | 146 | if (/^AssertionError/.test(msg)) { |
147 | if (match) { | 147 | return; |
148 | type = match[1].toLowerCase(); | ||
149 | message = match[2]; | ||
150 | } | ||
151 | if (type !== 'assertion') { | ||
152 | return this.test.uncaughtError(msg, this.currentTestFile, null, backtrace); | ||
153 | } | 148 | } |
154 | this.test.fail(message, { | 149 | this.test.fail(msg, { |
155 | type: type, | 150 | type: "error", |
156 | doThrow: false, | 151 | doThrow: false, |
157 | values: { | 152 | values: { |
158 | stack: backtrace | 153 | stack: backtrace | ... | ... |
-
Please register or sign in to post a comment