1 | 'use strict';
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | module.exports = Context;
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | function Context() {}
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | Context.prototype.runnable = function(runnable) {
|
26 | if (!arguments.length) {
|
27 | return this._runnable;
|
28 | }
|
29 | this.test = this._runnable = runnable;
|
30 | return this;
|
31 | };
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 | Context.prototype.timeout = function(ms) {
|
41 | if (!arguments.length) {
|
42 | return this.runnable().timeout();
|
43 | }
|
44 | this.runnable().timeout(ms);
|
45 | return this;
|
46 | };
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 | Context.prototype.enableTimeouts = function(enabled) {
|
56 | if (!arguments.length) {
|
57 | return this.runnable().enableTimeouts();
|
58 | }
|
59 | this.runnable().enableTimeouts(enabled);
|
60 | return this;
|
61 | };
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 | Context.prototype.slow = function(ms) {
|
71 | if (!arguments.length) {
|
72 | return this.runnable().slow();
|
73 | }
|
74 | this.runnable().slow(ms);
|
75 | return this;
|
76 | };
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 | Context.prototype.skip = function() {
|
85 | this.runnable().skip();
|
86 | };
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 | Context.prototype.retries = function(n) {
|
96 | if (!arguments.length) {
|
97 | return this.runnable().retries();
|
98 | }
|
99 | this.runnable().retries(n);
|
100 | return this;
|
101 | };
|