Commit a228e553 a228e5534f7b11c9a9d971f90c6edb010c4d6b49 by Julien Muetton

Implement `Tester.skip`

1 parent 3d5b91dd
...@@ -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.
......