1 | 'use strict';
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | var Runnable = require('./runnable');
|
8 | var create = require('lodash.create');
|
9 | var isString = require('./utils').isString;
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | module.exports = Test;
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | function Test (title, fn) {
|
25 | if (!isString(title)) {
|
26 | throw new Error('Test `title` should be a "string" but "' + typeof title + '" was given instead.');
|
27 | }
|
28 | Runnable.call(this, title, fn);
|
29 | this.pending = !fn;
|
30 | this.type = 'test';
|
31 | }
|
32 |
|
33 |
|
34 |
|
35 |
|
36 | Test.prototype = create(Runnable.prototype, {
|
37 | constructor: Test
|
38 | });
|
39 |
|
40 | Test.prototype.clone = function () {
|
41 | var test = new Test(this.title, this.fn);
|
42 | test.timeout(this.timeout());
|
43 | test.slow(this.slow());
|
44 | test.enableTimeouts(this.enableTimeouts());
|
45 | test.retries(this.retries());
|
46 | test.currentRetry(this.currentRetry());
|
47 | test.globals(this.globals());
|
48 | test.parent = this.parent;
|
49 | test.file = this.file;
|
50 | test.ctx = this.ctx;
|
51 | return test;
|
52 | };
|