codeceptjs 3.6.4 → 3.6.5-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/bin/codecept.js +84 -63
  2. package/lib/assert/empty.js +19 -19
  3. package/lib/assert/equal.js +32 -30
  4. package/lib/assert/error.js +14 -14
  5. package/lib/assert/include.js +42 -42
  6. package/lib/assert/throws.js +13 -11
  7. package/lib/assert/truth.js +17 -18
  8. package/lib/command/configMigrate.js +57 -52
  9. package/lib/command/definitions.js +88 -88
  10. package/lib/command/dryRun.js +65 -63
  11. package/lib/command/generate.js +191 -181
  12. package/lib/command/info.js +39 -37
  13. package/lib/command/init.js +289 -286
  14. package/lib/command/interactive.js +32 -32
  15. package/lib/command/list.js +26 -26
  16. package/lib/command/run-multiple.js +113 -93
  17. package/lib/command/run-rerun.js +22 -22
  18. package/lib/command/run-workers.js +63 -63
  19. package/lib/command/run.js +24 -26
  20. package/lib/command/utils.js +64 -63
  21. package/lib/data/context.js +60 -60
  22. package/lib/data/dataScenarioConfig.js +47 -47
  23. package/lib/data/dataTableArgument.js +29 -29
  24. package/lib/data/table.js +26 -20
  25. package/lib/helper/AI.js +67 -65
  26. package/lib/helper/ApiDataFactory.js +72 -69
  27. package/lib/helper/Appium.js +409 -379
  28. package/lib/helper/ExpectHelper.js +214 -248
  29. package/lib/helper/FileSystem.js +77 -78
  30. package/lib/helper/GraphQL.js +44 -43
  31. package/lib/helper/GraphQLDataFactory.js +49 -50
  32. package/lib/helper/JSONResponse.js +64 -62
  33. package/lib/helper/Mochawesome.js +28 -28
  34. package/lib/helper/MockServer.js +12 -12
  35. package/lib/helper/Nightmare.js +664 -572
  36. package/lib/helper/Playwright.js +1320 -1211
  37. package/lib/helper/Protractor.js +663 -629
  38. package/lib/helper/Puppeteer.js +1232 -1124
  39. package/lib/helper/REST.js +87 -72
  40. package/lib/helper/TestCafe.js +490 -491
  41. package/lib/helper/WebDriver.js +1294 -1156
  42. package/lib/interfaces/bdd.js +38 -51
  43. package/lib/interfaces/featureConfig.js +19 -19
  44. package/lib/interfaces/gherkin.js +122 -111
  45. package/lib/interfaces/scenarioConfig.js +29 -29
  46. package/lib/listener/artifacts.js +9 -9
  47. package/lib/listener/config.js +24 -23
  48. package/lib/listener/exit.js +12 -12
  49. package/lib/listener/helpers.js +42 -42
  50. package/lib/listener/mocha.js +11 -11
  51. package/lib/listener/retry.js +32 -30
  52. package/lib/listener/steps.js +50 -51
  53. package/lib/listener/timeout.js +53 -53
  54. package/lib/plugin/allure.js +14 -14
  55. package/lib/plugin/autoDelay.js +29 -36
  56. package/lib/plugin/autoLogin.js +70 -66
  57. package/lib/plugin/commentStep.js +18 -18
  58. package/lib/plugin/coverage.js +92 -77
  59. package/lib/plugin/customLocator.js +20 -19
  60. package/lib/plugin/debugErrors.js +24 -24
  61. package/lib/plugin/eachElement.js +37 -37
  62. package/lib/plugin/fakerTransform.js +6 -6
  63. package/lib/plugin/heal.js +66 -63
  64. package/lib/plugin/pauseOnFail.js +10 -10
  65. package/lib/plugin/retryFailedStep.js +31 -38
  66. package/lib/plugin/retryTo.js +28 -28
  67. package/lib/plugin/screenshotOnFail.js +107 -86
  68. package/lib/plugin/selenoid.js +131 -117
  69. package/lib/plugin/standardActingHelpers.js +2 -8
  70. package/lib/plugin/stepByStepReport.js +102 -92
  71. package/lib/plugin/stepTimeout.js +23 -22
  72. package/lib/plugin/subtitles.js +34 -34
  73. package/lib/plugin/tryTo.js +39 -29
  74. package/lib/plugin/wdio.js +77 -72
  75. package/lib/template/heal.js +11 -14
  76. package/package.json +4 -2
  77. package/translations/de-DE.js +1 -1
  78. package/translations/fr-FR.js +1 -1
  79. package/translations/index.js +9 -9
  80. package/translations/it-IT.js +1 -1
  81. package/translations/ja-JP.js +1 -1
  82. package/translations/pl-PL.js +1 -1
  83. package/translations/pt-BR.js +1 -1
  84. package/translations/ru-RU.js +1 -1
  85. package/translations/zh-CN.js +1 -1
  86. package/translations/zh-TW.js +1 -1
  87. package/typings/promiseBasedTypes.d.ts +238 -0
  88. package/typings/types.d.ts +32 -0
@@ -1,15 +1,15 @@
1
- const output = require('../output');
1
+ const output = require('../output')
2
2
 
3
- let expect;
3
+ let expect
4
4
 
5
- import('chai').then(chai => {
6
- expect = chai.expect;
7
- chai.use(require('chai-string'));
5
+ import('chai').then((chai) => {
6
+ expect = chai.expect
7
+ chai.use(require('chai-string'))
8
8
  // @ts-ignore
9
- chai.use(require('chai-exclude'));
10
- chai.use(require('chai-match-pattern'));
11
- chai.use(require('chai-json-schema'));
12
- });
9
+ chai.use(require('chai-exclude'))
10
+ chai.use(require('chai-match-pattern'))
11
+ chai.use(require('chai-json-schema'))
12
+ })
13
13
 
14
14
  /**
15
15
  * This helper allows performing assertions based on Chai.
@@ -32,27 +32,27 @@ import('chai').then(chai => {
32
32
  */
33
33
  class ExpectHelper {
34
34
  /**
35
- *
36
- * @param {*} actualValue
37
- * @param {*} expectedValue
38
- * @param {*} [customErrorMsg]
39
- */
35
+ *
36
+ * @param {*} actualValue
37
+ * @param {*} expectedValue
38
+ * @param {*} [customErrorMsg]
39
+ */
40
40
  expectEqual(actualValue, expectedValue, customErrorMsg = '') {
41
41
  // @ts-ignore
42
- output.step(`I expect "${JSON.stringify(actualValue)}" to equal "${JSON.stringify(expectedValue)}"`);
43
- return expect(actualValue, customErrorMsg).to.equal(expectedValue);
42
+ output.step(`I expect "${JSON.stringify(actualValue)}" to equal "${JSON.stringify(expectedValue)}"`)
43
+ return expect(actualValue, customErrorMsg).to.equal(expectedValue)
44
44
  }
45
45
 
46
46
  /**
47
- *
48
- * @param {*} actualValue
49
- * @param {*} expectedValue
50
- * @param {*} [customErrorMsg]
51
- */
47
+ *
48
+ * @param {*} actualValue
49
+ * @param {*} expectedValue
50
+ * @param {*} [customErrorMsg]
51
+ */
52
52
  expectNotEqual(actualValue, expectedValue, customErrorMsg = '') {
53
53
  // @ts-ignore
54
- output.step(`I expect "${JSON.stringify(actualValue)}" to not equal "${JSON.stringify(expectedValue)}"`);
55
- return expect(actualValue, customErrorMsg).not.to.equal(expectedValue);
54
+ output.step(`I expect "${JSON.stringify(actualValue)}" to not equal "${JSON.stringify(expectedValue)}"`)
55
+ return expect(actualValue, customErrorMsg).not.to.equal(expectedValue)
56
56
  }
57
57
 
58
58
  /**
@@ -64,362 +64,328 @@ class ExpectHelper {
64
64
  */
65
65
  expectDeepEqual(actualValue, expectedValue, customErrorMsg = '') {
66
66
  // @ts-ignore
67
- output.step(`I expect "${JSON.stringify(actualValue)}" to deep equal "${JSON.stringify(expectedValue)}"`);
68
- return expect(actualValue, customErrorMsg).to.deep.equal(expectedValue);
67
+ output.step(`I expect "${JSON.stringify(actualValue)}" to deep equal "${JSON.stringify(expectedValue)}"`)
68
+ return expect(actualValue, customErrorMsg).to.deep.equal(expectedValue)
69
69
  }
70
70
 
71
71
  /**
72
- *
73
- * @param {*} actualValue
74
- * @param {*} expectedValue
75
- * @param {*} [customErrorMsg]
76
- */
72
+ *
73
+ * @param {*} actualValue
74
+ * @param {*} expectedValue
75
+ * @param {*} [customErrorMsg]
76
+ */
77
77
  expectNotDeepEqual(actualValue, expectedValue, customErrorMsg = '') {
78
78
  // @ts-ignore
79
- output.step(`I expect "${JSON.stringify(actualValue)}" to not deep equal "${JSON.stringify(expectedValue)}"`);
80
- return expect(actualValue, customErrorMsg).to.not.deep.equal(expectedValue);
79
+ output.step(`I expect "${JSON.stringify(actualValue)}" to not deep equal "${JSON.stringify(expectedValue)}"`)
80
+ return expect(actualValue, customErrorMsg).to.not.deep.equal(expectedValue)
81
81
  }
82
82
 
83
83
  /**
84
- *
85
- * @param {*} actualValue
86
- * @param {*} expectedValueToContain
87
- * @param {*} [customErrorMsg]
88
- */
84
+ *
85
+ * @param {*} actualValue
86
+ * @param {*} expectedValueToContain
87
+ * @param {*} [customErrorMsg]
88
+ */
89
89
  expectContain(actualValue, expectedValueToContain, customErrorMsg = '') {
90
90
  // @ts-ignore
91
- output.step(`I expect "${JSON.stringify(actualValue)}" to contain "${JSON.stringify(expectedValueToContain)}"`);
92
- return expect(actualValue, customErrorMsg).to.contain(
93
- expectedValueToContain,
94
- );
91
+ output.step(`I expect "${JSON.stringify(actualValue)}" to contain "${JSON.stringify(expectedValueToContain)}"`)
92
+ return expect(actualValue, customErrorMsg).to.contain(expectedValueToContain)
95
93
  }
96
94
 
97
95
  /**
98
- *
99
- * @param {*} actualValue
100
- * @param {*} expectedValueToNotContain
101
- * @param {*} [customErrorMsg]
102
- */
103
- expectNotContain(
104
- actualValue,
105
- expectedValueToNotContain,
106
- customErrorMsg = '',
107
- ) {
96
+ *
97
+ * @param {*} actualValue
98
+ * @param {*} expectedValueToNotContain
99
+ * @param {*} [customErrorMsg]
100
+ */
101
+ expectNotContain(actualValue, expectedValueToNotContain, customErrorMsg = '') {
108
102
  // @ts-ignore
109
- output.step(`I expect "${JSON.stringify(actualValue)}" to not contain "${JSON.stringify(expectedValueToNotContain)}"`);
110
- return expect(actualValue, customErrorMsg).not.to.contain(
111
- expectedValueToNotContain,
112
- );
103
+ output.step(
104
+ `I expect "${JSON.stringify(actualValue)}" to not contain "${JSON.stringify(expectedValueToNotContain)}"`,
105
+ )
106
+ return expect(actualValue, customErrorMsg).not.to.contain(expectedValueToNotContain)
113
107
  }
114
108
 
115
109
  /**
116
- *
117
- * @param {*} actualValue
118
- * @param {*} expectedValueToStartWith
119
- * @param {*} [customErrorMsg]
120
- */
110
+ *
111
+ * @param {*} actualValue
112
+ * @param {*} expectedValueToStartWith
113
+ * @param {*} [customErrorMsg]
114
+ */
121
115
  expectStartsWith(actualValue, expectedValueToStartWith, customErrorMsg = '') {
122
116
  // @ts-ignore
123
- output.step(`I expect "${JSON.stringify(actualValue)}" to start with "${JSON.stringify(expectedValueToStartWith)}"`);
124
- return expect(actualValue, customErrorMsg).to.startsWith(
125
- expectedValueToStartWith,
126
- );
117
+ output.step(`I expect "${JSON.stringify(actualValue)}" to start with "${JSON.stringify(expectedValueToStartWith)}"`)
118
+ return expect(actualValue, customErrorMsg).to.startsWith(expectedValueToStartWith)
127
119
  }
128
120
 
129
121
  /**
130
- *
131
- * @param {*} actualValue
132
- * @param {*} expectedValueToNotStartWith
133
- * @param {*} [customErrorMsg]
134
- */
135
- expectNotStartsWith(
136
- actualValue,
137
- expectedValueToNotStartWith,
138
- customErrorMsg = '',
139
- ) {
122
+ *
123
+ * @param {*} actualValue
124
+ * @param {*} expectedValueToNotStartWith
125
+ * @param {*} [customErrorMsg]
126
+ */
127
+ expectNotStartsWith(actualValue, expectedValueToNotStartWith, customErrorMsg = '') {
140
128
  // @ts-ignore
141
- output.step(`I expect "${JSON.stringify(actualValue)}" to not start with "${JSON.stringify(expectedValueToNotStartWith)}"`);
142
- return expect(actualValue, customErrorMsg).not.to.startsWith(
143
- expectedValueToNotStartWith,
144
- );
129
+ output.step(
130
+ `I expect "${JSON.stringify(actualValue)}" to not start with "${JSON.stringify(expectedValueToNotStartWith)}"`,
131
+ )
132
+ return expect(actualValue, customErrorMsg).not.to.startsWith(expectedValueToNotStartWith)
145
133
  }
146
134
 
147
135
  /**
148
- * @param {*} actualValue
149
- * @param {*} expectedValueToEndWith
150
- * @param {*} [customErrorMsg]
151
- */
136
+ * @param {*} actualValue
137
+ * @param {*} expectedValueToEndWith
138
+ * @param {*} [customErrorMsg]
139
+ */
152
140
  expectEndsWith(actualValue, expectedValueToEndWith, customErrorMsg = '') {
153
141
  // @ts-ignore
154
- output.step(`I expect "${JSON.stringify(actualValue)}" to end with "${JSON.stringify(expectedValueToEndWith)}"`);
155
- return expect(actualValue, customErrorMsg).to.endsWith(
156
- expectedValueToEndWith,
157
- );
142
+ output.step(`I expect "${JSON.stringify(actualValue)}" to end with "${JSON.stringify(expectedValueToEndWith)}"`)
143
+ return expect(actualValue, customErrorMsg).to.endsWith(expectedValueToEndWith)
158
144
  }
159
145
 
160
146
  /**
161
- * @param {*} actualValue
162
- * @param {*} expectedValueToNotEndWith
163
- * @param {*} [customErrorMsg]
164
- */
165
- expectNotEndsWith(
166
- actualValue,
167
- expectedValueToNotEndWith,
168
- customErrorMsg = '',
169
- ) {
147
+ * @param {*} actualValue
148
+ * @param {*} expectedValueToNotEndWith
149
+ * @param {*} [customErrorMsg]
150
+ */
151
+ expectNotEndsWith(actualValue, expectedValueToNotEndWith, customErrorMsg = '') {
170
152
  // @ts-ignore
171
- output.step(`I expect "${JSON.stringify(actualValue)}" to not end with "${JSON.stringify(expectedValueToNotEndWith)}"`);
172
- return expect(actualValue, customErrorMsg).not.to.endsWith(
173
- expectedValueToNotEndWith,
174
- );
153
+ output.step(
154
+ `I expect "${JSON.stringify(actualValue)}" to not end with "${JSON.stringify(expectedValueToNotEndWith)}"`,
155
+ )
156
+ return expect(actualValue, customErrorMsg).not.to.endsWith(expectedValueToNotEndWith)
175
157
  }
176
158
 
177
159
  /**
178
- * @param {*} targetData
179
- * @param {*} jsonSchema
180
- * @param {*} [customErrorMsg]
181
- */
160
+ * @param {*} targetData
161
+ * @param {*} jsonSchema
162
+ * @param {*} [customErrorMsg]
163
+ */
182
164
  expectJsonSchema(targetData, jsonSchema, customErrorMsg = '') {
183
165
  // @ts-ignore
184
- output.step(`I expect "${JSON.stringify(targetData)}" to match this JSON schema "${JSON.stringify(jsonSchema)}"`);
166
+ output.step(`I expect "${JSON.stringify(targetData)}" to match this JSON schema "${JSON.stringify(jsonSchema)}"`)
185
167
 
186
- return expect(targetData, customErrorMsg).to.be.jsonSchema(jsonSchema);
168
+ return expect(targetData, customErrorMsg).to.be.jsonSchema(jsonSchema)
187
169
  }
188
170
 
189
171
  /**
190
- * @param {*} targetData
191
- * @param {*} jsonSchema
192
- * @param {*} [customErrorMsg]
193
- * @param {*} [ajvOptions] Pass AJV options
194
- */
195
- expectJsonSchemaUsingAJV(
196
- targetData,
197
- jsonSchema,
198
- customErrorMsg = '',
199
- ajvOptions = { allErrors: true },
200
- ) {
172
+ * @param {*} targetData
173
+ * @param {*} jsonSchema
174
+ * @param {*} [customErrorMsg]
175
+ * @param {*} [ajvOptions] Pass AJV options
176
+ */
177
+ expectJsonSchemaUsingAJV(targetData, jsonSchema, customErrorMsg = '', ajvOptions = { allErrors: true }) {
201
178
  // @ts-ignore
202
- output.step(`I expect "${JSON.stringify(targetData)}" to match this JSON schema using AJV "${JSON.stringify(jsonSchema)}"`);
203
- chai.use(require('chai-json-schema-ajv').create(ajvOptions));
204
- return expect(targetData, customErrorMsg).to.be.jsonSchema(jsonSchema);
179
+ output.step(
180
+ `I expect "${JSON.stringify(targetData)}" to match this JSON schema using AJV "${JSON.stringify(jsonSchema)}"`,
181
+ )
182
+ chai.use(require('chai-json-schema-ajv').create(ajvOptions))
183
+ return expect(targetData, customErrorMsg).to.be.jsonSchema(jsonSchema)
205
184
  }
206
185
 
207
186
  /**
208
- * @param {*} targetData
209
- * @param {*} propertyName
210
- * @param {*} [customErrorMsg]
211
- */
187
+ * @param {*} targetData
188
+ * @param {*} propertyName
189
+ * @param {*} [customErrorMsg]
190
+ */
212
191
  expectHasProperty(targetData, propertyName, customErrorMsg = '') {
213
192
  // @ts-ignore
214
- output.step(`I expect "${JSON.stringify(targetData)}" to have property: "${JSON.stringify(propertyName)}"`);
215
- return expect(targetData, customErrorMsg).to.have.property(propertyName);
193
+ output.step(`I expect "${JSON.stringify(targetData)}" to have property: "${JSON.stringify(propertyName)}"`)
194
+ return expect(targetData, customErrorMsg).to.have.property(propertyName)
216
195
  }
217
196
 
218
197
  /**
219
- * @param {*} targetData
220
- * @param {*} propertyName
221
- * @param {*} [customErrorMsg]
222
- */
198
+ * @param {*} targetData
199
+ * @param {*} propertyName
200
+ * @param {*} [customErrorMsg]
201
+ */
223
202
  expectHasAProperty(targetData, propertyName, customErrorMsg = '') {
224
203
  // @ts-ignore
225
- output.step(`I expect "${JSON.stringify(targetData)}" to have a property: "${JSON.stringify(propertyName)}"`);
226
- return expect(targetData, customErrorMsg).to.have.a.property(propertyName);
204
+ output.step(`I expect "${JSON.stringify(targetData)}" to have a property: "${JSON.stringify(propertyName)}"`)
205
+ return expect(targetData, customErrorMsg).to.have.a.property(propertyName)
227
206
  }
228
207
 
229
208
  /**
230
- * @param {*} targetData
231
- * @param {*} type
232
- * @param {*} [customErrorMsg]
233
- */
209
+ * @param {*} targetData
210
+ * @param {*} type
211
+ * @param {*} [customErrorMsg]
212
+ */
234
213
  expectToBeA(targetData, type, customErrorMsg = '') {
235
214
  // @ts-ignore
236
- output.step(`I expect "${JSON.stringify(targetData)}" to be a "${JSON.stringify(type)}"`);
237
- return expect(targetData, customErrorMsg).to.be.a(type);
215
+ output.step(`I expect "${JSON.stringify(targetData)}" to be a "${JSON.stringify(type)}"`)
216
+ return expect(targetData, customErrorMsg).to.be.a(type)
238
217
  }
239
218
 
240
219
  /**
241
- * @param {*} targetData
242
- * @param {*} type
243
- * @param {*} [customErrorMsg]
244
- */
220
+ * @param {*} targetData
221
+ * @param {*} type
222
+ * @param {*} [customErrorMsg]
223
+ */
245
224
  expectToBeAn(targetData, type, customErrorMsg = '') {
246
225
  // @ts-ignore
247
- output.step(`I expect "${JSON.stringify(targetData)}" to be an "${JSON.stringify(type)}"`);
248
- return expect(targetData, customErrorMsg).to.be.an(type);
226
+ output.step(`I expect "${JSON.stringify(targetData)}" to be an "${JSON.stringify(type)}"`)
227
+ return expect(targetData, customErrorMsg).to.be.an(type)
249
228
  }
250
229
 
251
230
  /**
252
- * @param {*} targetData
253
- * @param {*} regex
254
- * @param {*} [customErrorMsg]
255
- */
231
+ * @param {*} targetData
232
+ * @param {*} regex
233
+ * @param {*} [customErrorMsg]
234
+ */
256
235
  expectMatchRegex(targetData, regex, customErrorMsg = '') {
257
236
  // @ts-ignore
258
- output.step(`I expect "${JSON.stringify(targetData)}" to match the regex "${JSON.stringify(regex)}"`);
259
- return expect(targetData, customErrorMsg).to.match(regex);
237
+ output.step(`I expect "${JSON.stringify(targetData)}" to match the regex "${JSON.stringify(regex)}"`)
238
+ return expect(targetData, customErrorMsg).to.match(regex)
260
239
  }
261
240
 
262
241
  /**
263
- * @param {*} targetData
264
- * @param {*} length
265
- * @param {*} [customErrorMsg]
266
- */
242
+ * @param {*} targetData
243
+ * @param {*} length
244
+ * @param {*} [customErrorMsg]
245
+ */
267
246
  expectLengthOf(targetData, length, customErrorMsg = '') {
268
247
  // @ts-ignore
269
- output.step(`I expect "${JSON.stringify(targetData)}" to have length of "${JSON.stringify(length)}"`);
270
- return expect(targetData, customErrorMsg).to.have.lengthOf(length);
248
+ output.step(`I expect "${JSON.stringify(targetData)}" to have length of "${JSON.stringify(length)}"`)
249
+ return expect(targetData, customErrorMsg).to.have.lengthOf(length)
271
250
  }
272
251
 
273
252
  /**
274
- * @param {*} targetData
275
- * @param {*} [customErrorMsg]
276
- */
253
+ * @param {*} targetData
254
+ * @param {*} [customErrorMsg]
255
+ */
277
256
  expectEmpty(targetData, customErrorMsg = '') {
278
257
  // @ts-ignore
279
- output.step(`I expect "${JSON.stringify(targetData)}" to be empty`);
280
- return expect(targetData, customErrorMsg).to.be.empty;
258
+ output.step(`I expect "${JSON.stringify(targetData)}" to be empty`)
259
+ return expect(targetData, customErrorMsg).to.be.empty
281
260
  }
282
261
 
283
262
  /**
284
- * @param {*} targetData
285
- * @param {*} [customErrorMsg]
286
- */
263
+ * @param {*} targetData
264
+ * @param {*} [customErrorMsg]
265
+ */
287
266
  expectTrue(targetData, customErrorMsg = '') {
288
267
  // @ts-ignore
289
- output.step(`I expect "${JSON.stringify(targetData)}" to be true`);
290
- return expect(targetData, customErrorMsg).to.be.true;
268
+ output.step(`I expect "${JSON.stringify(targetData)}" to be true`)
269
+ return expect(targetData, customErrorMsg).to.be.true
291
270
  }
292
271
 
293
272
  /**
294
- * @param {*} targetData
295
- * @param {*} [customErrorMsg]
296
- */
273
+ * @param {*} targetData
274
+ * @param {*} [customErrorMsg]
275
+ */
297
276
  expectFalse(targetData, customErrorMsg = '') {
298
277
  // @ts-ignore
299
- output.step(`I expect "${JSON.stringify(targetData)}" to be false`);
300
- return expect(targetData, customErrorMsg).to.be.false;
278
+ output.step(`I expect "${JSON.stringify(targetData)}" to be false`)
279
+ return expect(targetData, customErrorMsg).to.be.false
301
280
  }
302
281
 
303
282
  /**
304
- * @param {*} targetData
305
- * @param {*} aboveThan
306
- * @param {*} [customErrorMsg]
307
- */
283
+ * @param {*} targetData
284
+ * @param {*} aboveThan
285
+ * @param {*} [customErrorMsg]
286
+ */
308
287
  expectAbove(targetData, aboveThan, customErrorMsg = '') {
309
288
  // @ts-ignore
310
- output.step(`I expect "${JSON.stringify(targetData)}" to be above ${JSON.stringify(aboveThan)}`);
311
- return expect(targetData, customErrorMsg).to.be.above(aboveThan);
289
+ output.step(`I expect "${JSON.stringify(targetData)}" to be above ${JSON.stringify(aboveThan)}`)
290
+ return expect(targetData, customErrorMsg).to.be.above(aboveThan)
312
291
  }
313
292
 
314
293
  /**
315
- * @param {*} targetData
316
- * @param {*} belowThan
317
- * @param {*} [customErrorMsg]
318
- */
294
+ * @param {*} targetData
295
+ * @param {*} belowThan
296
+ * @param {*} [customErrorMsg]
297
+ */
319
298
  expectBelow(targetData, belowThan, customErrorMsg = '') {
320
299
  // @ts-ignore
321
- output.step(`I expect "${JSON.stringify(targetData)}" to be below ${JSON.stringify(belowThan)}`);
322
- return expect(targetData, customErrorMsg).to.be.below(belowThan);
300
+ output.step(`I expect "${JSON.stringify(targetData)}" to be below ${JSON.stringify(belowThan)}`)
301
+ return expect(targetData, customErrorMsg).to.be.below(belowThan)
323
302
  }
324
303
 
325
304
  /**
326
- * @param {*} targetData
327
- * @param {*} lengthAboveThan
328
- * @param {*} [customErrorMsg]
329
- */
305
+ * @param {*} targetData
306
+ * @param {*} lengthAboveThan
307
+ * @param {*} [customErrorMsg]
308
+ */
330
309
  expectLengthAboveThan(targetData, lengthAboveThan, customErrorMsg = '') {
331
310
  // @ts-ignore
332
- output.step(`I expect "${JSON.stringify(targetData)}" to have length of above ${JSON.stringify(lengthAboveThan)}`);
333
- return expect(targetData, customErrorMsg).to.have.lengthOf.above(
334
- lengthAboveThan,
335
- );
311
+ output.step(`I expect "${JSON.stringify(targetData)}" to have length of above ${JSON.stringify(lengthAboveThan)}`)
312
+ return expect(targetData, customErrorMsg).to.have.lengthOf.above(lengthAboveThan)
336
313
  }
337
314
 
338
315
  /**
339
- * @param {*} targetData
340
- * @param {*} lengthBelowThan
341
- * @param {*} [customErrorMsg]
342
- */
316
+ * @param {*} targetData
317
+ * @param {*} lengthBelowThan
318
+ * @param {*} [customErrorMsg]
319
+ */
343
320
  expectLengthBelowThan(targetData, lengthBelowThan, customErrorMsg = '') {
344
321
  // @ts-ignore
345
- output.step(`I expect "${JSON.stringify(targetData)}" to have length of below ${JSON.stringify(lengthBelowThan)}`);
346
- return expect(targetData, customErrorMsg).to.have.lengthOf.below(
347
- lengthBelowThan,
348
- );
322
+ output.step(`I expect "${JSON.stringify(targetData)}" to have length of below ${JSON.stringify(lengthBelowThan)}`)
323
+ return expect(targetData, customErrorMsg).to.have.lengthOf.below(lengthBelowThan)
349
324
  }
350
325
 
351
326
  /**
352
- * @param {*} actualValue
353
- * @param {*} expectedValue
354
- * @param {*} [customErrorMsg]
355
- */
327
+ * @param {*} actualValue
328
+ * @param {*} expectedValue
329
+ * @param {*} [customErrorMsg]
330
+ */
356
331
  expectEqualIgnoreCase(actualValue, expectedValue, customErrorMsg = '') {
357
332
  // @ts-ignore
358
- output.step(`I expect and ingore case "${JSON.stringify(actualValue)}" to equal "${JSON.stringify(expectedValue)}"`);
359
- return expect(actualValue, customErrorMsg).to.equalIgnoreCase(
360
- expectedValue,
361
- );
333
+ output.step(`I expect and ingore case "${JSON.stringify(actualValue)}" to equal "${JSON.stringify(expectedValue)}"`)
334
+ return expect(actualValue, customErrorMsg).to.equalIgnoreCase(expectedValue)
362
335
  }
363
336
 
364
337
  /**
365
- * expects members of two arrays are deeply equal
366
- * @param {*} actualValue
367
- * @param {*} expectedValue
368
- * @param {*} [customErrorMsg]
369
- */
338
+ * expects members of two arrays are deeply equal
339
+ * @param {*} actualValue
340
+ * @param {*} expectedValue
341
+ * @param {*} [customErrorMsg]
342
+ */
370
343
  expectDeepMembers(actualValue, expectedValue, customErrorMsg = '') {
371
344
  // @ts-ignore
372
- output.step(`I expect members of "${JSON.stringify(actualValue)}" and "${JSON.stringify(expectedValue)}" arrays are deeply equal`);
373
- return expect(actualValue, customErrorMsg).to.have.deep.members(
374
- expectedValue,
375
- );
345
+ output.step(
346
+ `I expect members of "${JSON.stringify(actualValue)}" and "${JSON.stringify(expectedValue)}" arrays are deeply equal`,
347
+ )
348
+ return expect(actualValue, customErrorMsg).to.have.deep.members(expectedValue)
376
349
  }
377
350
 
378
351
  /**
379
- * expects an array to be a superset of another array
380
- * @param {*} superset
381
- * @param {*} set
382
- * @param {*} [customErrorMsg]
383
- */
352
+ * expects an array to be a superset of another array
353
+ * @param {*} superset
354
+ * @param {*} set
355
+ * @param {*} [customErrorMsg]
356
+ */
384
357
  expectDeepIncludeMembers(superset, set, customErrorMsg = '') {
385
358
  // @ts-ignore
386
- output.step(`I expect "${JSON.stringify(superset)}" array to be a superset of "${JSON.stringify(set)}" array`);
387
- return expect(superset, customErrorMsg).to.deep.include.members(
388
- set,
389
- );
359
+ output.step(`I expect "${JSON.stringify(superset)}" array to be a superset of "${JSON.stringify(set)}" array`)
360
+ return expect(superset, customErrorMsg).to.deep.include.members(set)
390
361
  }
391
362
 
392
363
  /**
393
- * expects members of two JSON objects are deeply equal excluding some properties
394
- * @param {*} actualValue
395
- * @param {*} expectedValue
396
- * @param {*} fieldsToExclude
397
- * @param {*} [customErrorMsg]
398
- */
399
- expectDeepEqualExcluding(
400
- actualValue,
401
- expectedValue,
402
- fieldsToExclude,
403
- customErrorMsg = '',
404
- ) {
364
+ * expects members of two JSON objects are deeply equal excluding some properties
365
+ * @param {*} actualValue
366
+ * @param {*} expectedValue
367
+ * @param {*} fieldsToExclude
368
+ * @param {*} [customErrorMsg]
369
+ */
370
+ expectDeepEqualExcluding(actualValue, expectedValue, fieldsToExclude, customErrorMsg = '') {
405
371
  // @ts-ignore
406
- output.step(`I expect members of "${JSON.stringify(actualValue)}" and "${JSON.stringify(expectedValue)}" JSON objects are deeply equal excluding properties: ${JSON.stringify(fieldsToExclude)}`);
407
- return expect(actualValue, customErrorMsg)
408
- .excludingEvery(fieldsToExclude)
409
- .to.deep.equal(expectedValue);
372
+ output.step(
373
+ `I expect members of "${JSON.stringify(actualValue)}" and "${JSON.stringify(expectedValue)}" JSON objects are deeply equal excluding properties: ${JSON.stringify(fieldsToExclude)}`,
374
+ )
375
+ return expect(actualValue, customErrorMsg).excludingEvery(fieldsToExclude).to.deep.equal(expectedValue)
410
376
  }
411
377
 
412
378
  /**
413
- * expects a JSON object matches a provided pattern
414
- * @param {*} actualValue
415
- * @param {*} expectedPattern
416
- * @param {*} [customErrorMsg]
417
- */
379
+ * expects a JSON object matches a provided pattern
380
+ * @param {*} actualValue
381
+ * @param {*} expectedPattern
382
+ * @param {*} [customErrorMsg]
383
+ */
418
384
  expectMatchesPattern(actualValue, expectedPattern, customErrorMsg = '') {
419
385
  // @ts-ignore
420
- output.step(`I expect "${JSON.stringify(actualValue)}" to match the ${JSON.stringify(expectedPattern)} pattern`);
421
- return expect(actualValue, customErrorMsg).to.matchPattern(expectedPattern);
386
+ output.step(`I expect "${JSON.stringify(actualValue)}" to match the ${JSON.stringify(expectedPattern)} pattern`)
387
+ return expect(actualValue, customErrorMsg).to.matchPattern(expectedPattern)
422
388
  }
423
389
  }
424
390
 
425
- module.exports = ExpectHelper;
391
+ module.exports = ExpectHelper