Implement `Tester.skip`
Showing
2 changed files
with
25 additions
and
1 deletions
... | @@ -66,7 +66,9 @@ var Colorizer = function Colorizer() { | ... | @@ -66,7 +66,9 @@ var Colorizer = function Colorizer() { |
66 | 'GREEN_BAR': { fg: 'white', bg: 'green', bold: true }, | 66 | 'GREEN_BAR': { fg: 'white', bg: 'green', bold: true }, |
67 | 'RED_BAR': { fg: 'white', bg: 'red', bold: true }, | 67 | 'RED_BAR': { fg: 'white', bg: 'red', bold: true }, |
68 | 'INFO_BAR': { bg: 'cyan', fg: 'white', bold: true }, | 68 | 'INFO_BAR': { bg: 'cyan', fg: 'white', bold: true }, |
69 | 'WARN_BAR': { bg: 'yellow', fg: 'white', bold: true } | 69 | 'WARN_BAR': { bg: 'yellow', fg: 'white', bold: true }, |
70 | 'SKIP': { fg: 'magenta', bold: true }, | ||
71 | 'SKIP_BAR': { bg: 'magenta', fg: 'black', bold: true } | ||
70 | }; | 72 | }; |
71 | 73 | ||
72 | /** | 74 | /** | ... | ... |
... | @@ -222,6 +222,28 @@ Tester.prototype.abort = function abort(message) { | ... | @@ -222,6 +222,28 @@ Tester.prototype.abort = function abort(message) { |
222 | }; | 222 | }; |
223 | 223 | ||
224 | /** | 224 | /** |
225 | * Aborts current test suite. | ||
226 | * | ||
227 | * @param {String} message Warning message (optional) | ||
228 | */ | ||
229 | Tester.prototype.skip = function skip(number, message) { | ||
230 | "use strict"; | ||
231 | var step = this.casper.step, | ||
232 | steps = this.casper.steps, | ||
233 | last = steps.length; | ||
234 | |||
235 | if (message) { | ||
236 | this.casper.echo([ | ||
237 | this.casper.colorize('SKIP', 'SKIP'), | ||
238 | 'test suite aborted: ' + message | ||
239 | ].join(' ')); | ||
240 | } | ||
241 | this.casper.step = Math.min(step + number, last); | ||
242 | |||
243 | return this; | ||
244 | }; | ||
245 | |||
246 | /** | ||
225 | * Asserts that a condition strictly resolves to true. Also returns an | 247 | * Asserts that a condition strictly resolves to true. Also returns an |
226 | * "assertion object" containing useful informations about the test case | 248 | * "assertion object" containing useful informations about the test case |
227 | * results. | 249 | * results. | ... | ... |
-
Please register or sign in to post a comment