MCPcopy
hub / github.com/codeceptjs/CodeceptJS / ScenarioConfig

Class ScenarioConfig

lib/mocha/scenarioConfig.js:5–137  ·  view source on GitHub ↗

@class

Source from the content-addressed store, hash-verified

3
4/** @class */
5class ScenarioConfig {
6 /**
7 * @param {CodeceptJS.Test} test
8 */
9 constructor(test) {
10 this.test = test
11 }
12
13 /**
14 * Declares that test throws error.
15 * Can pass an Error object or regex matching expected message.
16 *
17 * @param {*} err
18 * @returns {this}
19 */
20 throws(err) {
21 this.test.throws = err
22 return this
23 }
24
25 /**
26 * Declares that test should fail.
27 * If test passes - throws an error.
28 * Can pass an Error object or regex matching expected message.
29 *
30 * @returns {this}
31 */
32 fails() {
33 this.test.throws = new Error()
34 return this
35 }
36
37 /**
38 * Retry this test for x times
39 *
40 * @param {number} retries
41 * @returns {this}
42 */
43 retry(retries) {
44 if (store.scenarioOnly) retries = -retries
45 this.test.retries(retries)
46 return this
47 }
48
49 /**
50 * Set metadata for this test
51 * @param {string} key
52 * @param {string} value
53 * @returns {this}
54 */
55 meta(key, value) {
56 this.test.meta[key] = value
57 return this
58 }
59
60 /**
61 * Set timeout for this test
62 * @param {number} timeout

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected