codeceptjs 3.6.6-beta.1 → 3.6.6-beta.3

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.
@@ -2396,9 +2396,9 @@ class Playwright extends Helper {
2396
2396
  }
2397
2397
 
2398
2398
  if (this.options.recordVideo && this.page && this.page.video()) {
2399
- test.artifacts.video = await saveVideoForPage(this.page, `${test.title}.failed`)
2399
+ test.artifacts.video = saveVideoForPage(this.page, `${test.title}.failed`)
2400
2400
  for (const sessionName in this.sessionPages) {
2401
- test.artifacts[`video_${sessionName}`] = await saveVideoForPage(
2401
+ test.artifacts[`video_${sessionName}`] = saveVideoForPage(
2402
2402
  this.sessionPages[sessionName],
2403
2403
  `${test.title}_${sessionName}.failed`,
2404
2404
  )
@@ -2424,9 +2424,9 @@ class Playwright extends Helper {
2424
2424
  async _passed(test) {
2425
2425
  if (this.options.recordVideo && this.page && this.page.video()) {
2426
2426
  if (this.options.keepVideoForPassedTests) {
2427
- test.artifacts.video = await saveVideoForPage(this.page, `${test.title}.passed`)
2427
+ test.artifacts.video = saveVideoForPage(this.page, `${test.title}.passed`)
2428
2428
  for (const sessionName of Object.keys(this.sessionPages)) {
2429
- test.artifacts[`video_${sessionName}`] = await saveVideoForPage(
2429
+ test.artifacts[`video_${sessionName}`] = saveVideoForPage(
2430
2430
  this.sessionPages[sessionName],
2431
2431
  `${test.title}_${sessionName}.passed`,
2432
2432
  )
@@ -3917,7 +3917,7 @@ async function refreshContextSession() {
3917
3917
  }
3918
3918
  }
3919
3919
 
3920
- async function saveVideoForPage(page, name) {
3920
+ function saveVideoForPage(page, name) {
3921
3921
  if (!page.video()) return null
3922
3922
  const fileName = `${`${global.output_dir}${pathSeparator}videos${pathSeparator}${uuidv4()}_${clearString(name)}`.slice(0, 245)}.webm`
3923
3923
  page
@@ -3928,11 +3928,10 @@ async function saveVideoForPage(page, name) {
3928
3928
  page
3929
3929
  .video()
3930
3930
  .delete()
3931
- .catch((e) => {})
3931
+ .catch(() => {})
3932
3932
  })
3933
3933
  return fileName
3934
3934
  }
3935
-
3936
3935
  async function saveTraceForContext(context, name) {
3937
3936
  if (!context) return
3938
3937
  if (!context.tracing) return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "3.6.6-beta.1",
3
+ "version": "3.6.6-beta.3",
4
4
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
5
5
  "keywords": [
6
6
  "acceptance",
@@ -66,7 +66,8 @@
66
66
  "types-fix": "node typings/fixDefFiles.js",
67
67
  "dtslint": "npm run types-fix && tsd",
68
68
  "prepare": "husky install",
69
- "prepare-release": "./runok.js versioning && ./runok.js get:commit-log"
69
+ "prepare-release": "./runok.js versioning && ./runok.js get:commit-log",
70
+ "publish-beta": "./runok.js publish:next-beta-version"
70
71
  },
71
72
  "dependencies": {
72
73
  "@codeceptjs/configure": "1.0.1",
@@ -105,10 +106,10 @@
105
106
  "lodash.merge": "4.6.2",
106
107
  "mkdirp": "1.0.4",
107
108
  "mocha": "10.6.0",
108
- "monocart-coverage-reports": "2.10.0",
109
+ "monocart-coverage-reports": "2.10.3",
109
110
  "ms": "2.1.3",
110
111
  "ora-classic": "5.4.2",
111
- "pactum": "3.6.9",
112
+ "pactum": "3.7.1",
112
113
  "parse-function": "5.6.10",
113
114
  "parse5": "7.1.2",
114
115
  "promise-retry": "1.1.1",
@@ -155,6 +156,7 @@
155
156
  "qrcode-terminal": "0.12.0",
156
157
  "rosie": "2.1.1",
157
158
  "runok": "0.9.3",
159
+ "semver": "^7.6.3",
158
160
  "sinon": "18.0.0",
159
161
  "sinon-chai": "3.7.0",
160
162
  "testcafe": "3.5.0",
@@ -1181,6 +1181,12 @@ declare namespace CodeceptJS {
1181
1181
  * ## Methods
1182
1182
  */
1183
1183
  // @ts-ignore
1184
+ // @ts-ignore
1185
+ // @ts-ignore
1186
+ // @ts-ignore
1187
+ // @ts-ignore
1188
+ // @ts-ignore
1189
+ // @ts-ignore
1184
1190
  class ExpectHelper {
1185
1191
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1186
1192
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
@@ -1293,6 +1299,12 @@ declare namespace CodeceptJS {
1293
1299
  * ## Methods
1294
1300
  */
1295
1301
  // @ts-ignore
1302
+ // @ts-ignore
1303
+ // @ts-ignore
1304
+ // @ts-ignore
1305
+ // @ts-ignore
1306
+ // @ts-ignore
1307
+ // @ts-ignore
1296
1308
  class ExpectHelper {
1297
1309
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1298
1310
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
@@ -1965,6 +1977,12 @@ declare namespace CodeceptJS {
1965
1977
  * @property [httpsOpts] - key & cert values are the paths to .key and .crt files
1966
1978
  */
1967
1979
  // @ts-ignore
1980
+ // @ts-ignore
1981
+ // @ts-ignore
1982
+ // @ts-ignore
1983
+ // @ts-ignore
1984
+ // @ts-ignore
1985
+ // @ts-ignore
1968
1986
  type MockServerConfig = {
1969
1987
  port?: number;
1970
1988
  host?: string;
@@ -2090,6 +2108,12 @@ declare namespace CodeceptJS {
2090
2108
  * ## Methods
2091
2109
  */
2092
2110
  // @ts-ignore
2111
+ // @ts-ignore
2112
+ // @ts-ignore
2113
+ // @ts-ignore
2114
+ // @ts-ignore
2115
+ // @ts-ignore
2116
+ // @ts-ignore
2093
2117
  class MockServer {
2094
2118
  /**
2095
2119
  * Start the mock server
@@ -3164,6 +3188,12 @@ declare namespace CodeceptJS {
3164
3188
  * @property [testIdAttribute = data-testid] - locate elements based on the testIdAttribute. See more of [locate by test id](https://playwright.dev/docs/locators#locate-by-test-id).
3165
3189
  */
3166
3190
  // @ts-ignore
3191
+ // @ts-ignore
3192
+ // @ts-ignore
3193
+ // @ts-ignore
3194
+ // @ts-ignore
3195
+ // @ts-ignore
3196
+ // @ts-ignore
3167
3197
  type PlaywrightConfig = {
3168
3198
  url?: string;
3169
3199
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -6541,6 +6571,12 @@ declare namespace CodeceptJS {
6541
6571
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
6542
6572
  */
6543
6573
  // @ts-ignore
6574
+ // @ts-ignore
6575
+ // @ts-ignore
6576
+ // @ts-ignore
6577
+ // @ts-ignore
6578
+ // @ts-ignore
6579
+ // @ts-ignore
6544
6580
  type PuppeteerConfig = {
6545
6581
  url: string;
6546
6582
  basicAuth?: any;
@@ -8348,6 +8384,12 @@ declare namespace CodeceptJS {
8348
8384
  * @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
8349
8385
  */
8350
8386
  // @ts-ignore
8387
+ // @ts-ignore
8388
+ // @ts-ignore
8389
+ // @ts-ignore
8390
+ // @ts-ignore
8391
+ // @ts-ignore
8392
+ // @ts-ignore
8351
8393
  type RESTConfig = {
8352
8394
  endpoint?: string;
8353
8395
  prettyPrintJson?: boolean;
@@ -9711,6 +9753,12 @@ declare namespace CodeceptJS {
9711
9753
  * @property [devtoolsProtocol = false] - enable devtools protocol. Default: false. More info: https://webdriver.io/docs/automationProtocols/#devtools-protocol.
9712
9754
  */
9713
9755
  // @ts-ignore
9756
+ // @ts-ignore
9757
+ // @ts-ignore
9758
+ // @ts-ignore
9759
+ // @ts-ignore
9760
+ // @ts-ignore
9761
+ // @ts-ignore
9714
9762
  type WebDriverConfig = {
9715
9763
  url: string;
9716
9764
  browser: string;
@@ -1205,6 +1205,12 @@ declare namespace CodeceptJS {
1205
1205
  * ## Methods
1206
1206
  */
1207
1207
  // @ts-ignore
1208
+ // @ts-ignore
1209
+ // @ts-ignore
1210
+ // @ts-ignore
1211
+ // @ts-ignore
1212
+ // @ts-ignore
1213
+ // @ts-ignore
1208
1214
  class ExpectHelper {
1209
1215
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1210
1216
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
@@ -1317,6 +1323,12 @@ declare namespace CodeceptJS {
1317
1323
  * ## Methods
1318
1324
  */
1319
1325
  // @ts-ignore
1326
+ // @ts-ignore
1327
+ // @ts-ignore
1328
+ // @ts-ignore
1329
+ // @ts-ignore
1330
+ // @ts-ignore
1331
+ // @ts-ignore
1320
1332
  class ExpectHelper {
1321
1333
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1322
1334
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
@@ -1992,6 +2004,12 @@ declare namespace CodeceptJS {
1992
2004
  * @property [httpsOpts] - key & cert values are the paths to .key and .crt files
1993
2005
  */
1994
2006
  // @ts-ignore
2007
+ // @ts-ignore
2008
+ // @ts-ignore
2009
+ // @ts-ignore
2010
+ // @ts-ignore
2011
+ // @ts-ignore
2012
+ // @ts-ignore
1995
2013
  type MockServerConfig = {
1996
2014
  port?: number;
1997
2015
  host?: string;
@@ -2117,6 +2135,12 @@ declare namespace CodeceptJS {
2117
2135
  * ## Methods
2118
2136
  */
2119
2137
  // @ts-ignore
2138
+ // @ts-ignore
2139
+ // @ts-ignore
2140
+ // @ts-ignore
2141
+ // @ts-ignore
2142
+ // @ts-ignore
2143
+ // @ts-ignore
2120
2144
  class MockServer {
2121
2145
  /**
2122
2146
  * Start the mock server
@@ -3257,6 +3281,12 @@ declare namespace CodeceptJS {
3257
3281
  * @property [testIdAttribute = data-testid] - locate elements based on the testIdAttribute. See more of [locate by test id](https://playwright.dev/docs/locators#locate-by-test-id).
3258
3282
  */
3259
3283
  // @ts-ignore
3284
+ // @ts-ignore
3285
+ // @ts-ignore
3286
+ // @ts-ignore
3287
+ // @ts-ignore
3288
+ // @ts-ignore
3289
+ // @ts-ignore
3260
3290
  type PlaywrightConfig = {
3261
3291
  url?: string;
3262
3292
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -6785,6 +6815,12 @@ declare namespace CodeceptJS {
6785
6815
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
6786
6816
  */
6787
6817
  // @ts-ignore
6818
+ // @ts-ignore
6819
+ // @ts-ignore
6820
+ // @ts-ignore
6821
+ // @ts-ignore
6822
+ // @ts-ignore
6823
+ // @ts-ignore
6788
6824
  type PuppeteerConfig = {
6789
6825
  url: string;
6790
6826
  basicAuth?: any;
@@ -8728,6 +8764,12 @@ declare namespace CodeceptJS {
8728
8764
  * @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
8729
8765
  */
8730
8766
  // @ts-ignore
8767
+ // @ts-ignore
8768
+ // @ts-ignore
8769
+ // @ts-ignore
8770
+ // @ts-ignore
8771
+ // @ts-ignore
8772
+ // @ts-ignore
8731
8773
  type RESTConfig = {
8732
8774
  endpoint?: string;
8733
8775
  prettyPrintJson?: boolean;
@@ -10151,6 +10193,12 @@ declare namespace CodeceptJS {
10151
10193
  * @property [devtoolsProtocol = false] - enable devtools protocol. Default: false. More info: https://webdriver.io/docs/automationProtocols/#devtools-protocol.
10152
10194
  */
10153
10195
  // @ts-ignore
10196
+ // @ts-ignore
10197
+ // @ts-ignore
10198
+ // @ts-ignore
10199
+ // @ts-ignore
10200
+ // @ts-ignore
10201
+ // @ts-ignore
10154
10202
  type WebDriverConfig = {
10155
10203
  url: string;
10156
10204
  browser: string;
@@ -1,381 +0,0 @@
1
- const ExpectHelper = require('./ExpectHelper')
2
-
3
- /**
4
- * SoftAssertHelper is a utility class for performing soft assertions.
5
- * Unlike traditional assertions that stop the execution on failure,
6
- * soft assertions allow the execution to continue and report all failures at the end.
7
- *
8
- * ### Examples
9
- *
10
- * Zero-configuration when paired with other helpers like REST, Playwright:
11
- *
12
- * ```js
13
- * // inside codecept.conf.js
14
- * {
15
- * helpers: {
16
- * Playwright: {...},
17
- * SoftExpectHelper: {},
18
- * }
19
- * }
20
- * ```
21
- *
22
- * ```js
23
- * // in scenario
24
- * I.softExpectEqual('a', 'b')
25
- * I.flushSoftAssertions() // Throws an error if any soft assertions have failed. The error message contains all the accumulated failures.
26
- * ```
27
- *
28
- * ## Methods
29
- */
30
- class SoftAssertHelper extends ExpectHelper {
31
- constructor() {
32
- super()
33
- this.errors = []
34
- }
35
-
36
- /**
37
- * Performs a soft assertion by executing the provided assertion function.
38
- * If the assertion fails, the error is caught and stored without halting the execution.
39
- *
40
- * @param {Function} assertionFn - The assertion function to execute.
41
- * @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
42
- */
43
- softAssert(assertionFn, customErrorMsg = '') {
44
- try {
45
- assertionFn()
46
- } catch (error) {
47
- this.errors.push({ customErrorMsg, error })
48
- }
49
- }
50
-
51
- /**
52
- * Throws an error if any soft assertions have failed.
53
- * The error message contains all the accumulated failures.
54
- *
55
- * @throws {Error} If there are any soft assertion failures.
56
- */
57
- flushSoftAssertions() {
58
- if (this.errors.length > 0) {
59
- let errorMessage = 'Soft assertions failed:\n'
60
- this.errors.forEach((err, index) => {
61
- errorMessage += `\n[${index + 1}] ${err.customErrorMsg}\n${err.error.message}\n`
62
- })
63
- this.errors = []
64
- throw new Error(errorMessage)
65
- }
66
- }
67
-
68
- /**
69
- * Softly asserts that two values are equal.
70
- *
71
- * @param {*} actualValue - The actual value.
72
- * @param {*} expectedValue - The expected value.
73
- * @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
74
- */
75
- softExpectEqual(actualValue, expectedValue, customErrorMsg = '') {
76
- this.softAssert(() => this.expectEqual(actualValue, expectedValue, customErrorMsg), customErrorMsg)
77
- }
78
-
79
- /**
80
- * Softly asserts that two values are not equal.
81
- *
82
- * @param {*} actualValue - The actual value.
83
- * @param {*} expectedValue - The expected value.
84
- * @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
85
- */
86
- softExpectNotEqual(actualValue, expectedValue, customErrorMsg = '') {
87
- this.softAssert(() => this.expectNotEqual(actualValue, expectedValue, customErrorMsg), customErrorMsg)
88
- }
89
-
90
- /**
91
- * Softly asserts that two values are deeply equal.
92
- *
93
- * @param {*} actualValue - The actual value.
94
- * @param {*} expectedValue - The expected value.
95
- * @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
96
- */
97
- softExpectDeepEqual(actualValue, expectedValue, customErrorMsg = '') {
98
- this.softAssert(() => this.expectDeepEqual(actualValue, expectedValue, customErrorMsg), customErrorMsg)
99
- }
100
-
101
- /**
102
- * Softly asserts that two values are not deeply equal.
103
- *
104
- * @param {*} actualValue - The actual value.
105
- * @param {*} expectedValue - The expected value.
106
- * @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
107
- */
108
- softExpectNotDeepEqual(actualValue, expectedValue, customErrorMsg = '') {
109
- this.softAssert(() => this.expectNotDeepEqual(actualValue, expectedValue, customErrorMsg), customErrorMsg)
110
- }
111
-
112
- /**
113
- * Softly asserts that a value contains the expected value.
114
- *
115
- * @param {*} actualValue - The actual value.
116
- * @param {*} expectedValueToContain - The value that should be contained within the actual value.
117
- * @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
118
- */
119
- softExpectContain(actualValue, expectedValueToContain, customErrorMsg = '') {
120
- this.softAssert(() => this.expectContain(actualValue, expectedValueToContain, customErrorMsg), customErrorMsg)
121
- }
122
-
123
- /**
124
- * Softly asserts that a value does not contain the expected value.
125
- *
126
- * @param {*} actualValue - The actual value.
127
- * @param {*} expectedValueToNotContain - The value that should not be contained within the actual value.
128
- * @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
129
- */
130
- softExpectNotContain(actualValue, expectedValueToNotContain, customErrorMsg = '') {
131
- this.softAssert(() => this.expectNotContain(actualValue, expectedValueToNotContain, customErrorMsg), customErrorMsg)
132
- }
133
-
134
- /**
135
- * Softly asserts that a value starts with the expected value.
136
- *
137
- * @param {*} actualValue - The actual value.
138
- * @param {*} expectedValueToStartWith - The value that the actual value should start with.
139
- * @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
140
- */
141
- softExpectStartsWith(actualValue, expectedValueToStartWith, customErrorMsg = '') {
142
- this.softAssert(() => this.expectStartsWith(actualValue, expectedValueToStartWith, customErrorMsg), customErrorMsg)
143
- }
144
-
145
- /**
146
- * Softly asserts that a value does not start with the expected value.
147
- *
148
- * @param {*} actualValue - The actual value.
149
- * @param {*} expectedValueToNotStartWith - The value that the actual value should not start with.
150
- * @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
151
- */
152
- softExpectNotStartsWith(actualValue, expectedValueToNotStartWith, customErrorMsg = '') {
153
- this.softAssert(
154
- () => this.expectNotStartsWith(actualValue, expectedValueToNotStartWith, customErrorMsg),
155
- customErrorMsg,
156
- )
157
- }
158
-
159
- /**
160
- * Softly asserts that a value ends with the expected value.
161
- *
162
- * @param {*} actualValue - The actual value.
163
- * @param {*} expectedValueToEndWith - The value that the actual value should end with.
164
- * @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
165
- */
166
- softExpectEndsWith(actualValue, expectedValueToEndWith, customErrorMsg = '') {
167
- this.softAssert(() => this.expectEndsWith(actualValue, expectedValueToEndWith, customErrorMsg), customErrorMsg)
168
- }
169
-
170
- /**
171
- * Softly asserts that a value does not end with the expected value.
172
- *
173
- * @param {*} actualValue - The actual value.
174
- * @param {*} expectedValueToNotEndWith - The value that the actual value should not end with.
175
- * @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
176
- */
177
- softExpectNotEndsWith(actualValue, expectedValueToNotEndWith, customErrorMsg = '') {
178
- this.softAssert(
179
- () => this.expectNotEndsWith(actualValue, expectedValueToNotEndWith, customErrorMsg),
180
- customErrorMsg,
181
- )
182
- }
183
-
184
- /**
185
- * Softly asserts that the target data matches the given JSON schema.
186
- *
187
- * @param {*} targetData - The data to validate.
188
- * @param {Object} jsonSchema - The JSON schema to validate against.
189
- * @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
190
- */
191
- softExpectJsonSchema(targetData, jsonSchema, customErrorMsg = '') {
192
- this.softAssert(() => this.expectJsonSchema(targetData, jsonSchema, customErrorMsg), customErrorMsg)
193
- }
194
-
195
- /**
196
- * Softly asserts that the target data matches the given JSON schema using AJV.
197
- *
198
- * @param {*} targetData - The data to validate.
199
- * @param {Object} jsonSchema - The JSON schema to validate against.
200
- * @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
201
- * @param {Object} [ajvOptions={ allErrors: true }] - Options to pass to AJV.
202
- */
203
- softExpectJsonSchemaUsingAJV(targetData, jsonSchema, customErrorMsg = '', ajvOptions = { allErrors: true }) {
204
- this.softAssert(
205
- () => this.expectJsonSchemaUsingAJV(targetData, jsonSchema, customErrorMsg, ajvOptions),
206
- customErrorMsg,
207
- )
208
- }
209
-
210
- /**
211
- * Softly asserts that the target data has the specified property.
212
- *
213
- * @param {*} targetData - The data to check.
214
- * @param {string} propertyName - The property name to check for.
215
- * @param {string} [customErrorMsg=''] - A custom error message to display if the assertion
216
- fails. */ softExpectHasProperty(targetData, propertyName, customErrorMsg = '') {
217
- this.softAssert(() => this.expectHasProperty(targetData, propertyName, customErrorMsg), customErrorMsg)
218
- }
219
-
220
- /**
221
- Softly asserts that the target data has a property with the specified name.
222
- @param {*} targetData - The data to check.
223
- @param {string} propertyName - The property name to check for.
224
- @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
225
- */
226
- softExpectHasAProperty(targetData, propertyName, customErrorMsg = '') {
227
- this.softAssert(() => this.expectHasAProperty(targetData, propertyName, customErrorMsg), customErrorMsg)
228
- }
229
-
230
- /**
231
- Softly asserts that the target data is of a specific type.
232
- @param {*} targetData - The data to check.
233
- @param {string} type - The expected type (e.g., 'string', 'number').
234
- @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
235
- softExpectToBeA(targetData, type, customErrorMsg = '') {
236
- this.softAssert(() => this.expectToBeA(targetData, type, customErrorMsg), customErrorMsg)
237
- }
238
-
239
- /**
240
- Softly asserts that the target data is of a specific type (alternative for articles).
241
- @param {*} targetData - The data to check.
242
- @param {string} type - The expected type (e.g., 'string', 'number').
243
- @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
244
- softExpectToBeAn(targetData, type, customErrorMsg = '') {
245
- this.softAssert(() => this.expectToBeAn(targetData, type, customErrorMsg), customErrorMsg)
246
- }
247
-
248
- /*
249
- Softly asserts that the target data matches the specified regular expression.
250
- @param {*} targetData - The data to check.
251
- @param {RegExp} regex - The regular expression to match.
252
- @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
253
- softExpectMatchRegex(targetData, regex, customErrorMsg = '') {
254
- this.softAssert(() => this.expectMatchRegex(targetData, regex, customErrorMsg), customErrorMsg)
255
- }
256
-
257
- /**
258
- Softly asserts that the target data has a specified length.
259
- @param {*} targetData - The data to check.
260
- @param {number} length - The expected length.
261
- @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
262
- softExpectLengthOf(targetData, length, customErrorMsg = '') {
263
- this.softAssert(() => this.expectLengthOf(targetData, length, customErrorMsg), customErrorMsg)
264
- }
265
-
266
- /**
267
-
268
- Softly asserts that the target data is empty.
269
- @param {*} targetData - The data to check.
270
- @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
271
- softExpectEmpty(targetData, customErrorMsg = '') {
272
- this.softAssert(() => this.expectEmpty(targetData, customErrorMsg), customErrorMsg)
273
- }
274
-
275
- /**
276
-
277
- Softly asserts that the target data is true.
278
- @param {*} targetData - The data to check.
279
- @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
280
- softExpectTrue(targetData, customErrorMsg = '') {
281
- this.softAssert(() => this.expectTrue(targetData, customErrorMsg), customErrorMsg)
282
- }
283
-
284
- /**
285
-
286
- Softly asserts that the target data is false.
287
- @param {*} targetData - The data to check.
288
- @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
289
- softExpectFalse(targetData, customErrorMsg = '') {
290
- this.softAssert(() => this.expectFalse(targetData, customErrorMsg), customErrorMsg)
291
- }
292
-
293
- /**
294
-
295
- Softly asserts that the target data is above a specified value.
296
- @param {*} targetData - The data to check.
297
- @param {*} aboveThan - The value that the target data should be above.
298
- @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
299
- softExpectAbove(targetData, aboveThan, customErrorMsg = '') {
300
- this.softAssert(() => this.expectAbove(targetData, aboveThan, customErrorMsg), customErrorMsg)
301
- }
302
-
303
- /**
304
-
305
- Softly asserts that the target data is below a specified value.
306
- @param {*} targetData - The data to check.
307
- @param {*} belowThan - The value that the target data should be below.
308
- @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
309
- softExpectBelow(targetData, belowThan, customErrorMsg = '') {
310
- this.softAssert(() => this.expectBelow(targetData, belowThan, customErrorMsg), customErrorMsg)
311
- }
312
-
313
- /**
314
-
315
- Softly asserts that the length of the target data is above a specified value.
316
- @param {*} targetData - The data to check.
317
- @param {number} lengthAboveThan - The length that the target data should be above.
318
- @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
319
- softExpectLengthAboveThan(targetData, lengthAboveThan, customErrorMsg = '') {
320
- this.softAssert(() => this.expectLengthAboveThan(targetData, lengthAboveThan, customErrorMsg), customErrorMsg)
321
- }
322
-
323
- /**
324
- Softly asserts that the length of the target data is below a specified value.
325
- @param {*} targetData - The data to check.
326
- @param {number} lengthBelowThan - The length that the target data should be below.
327
- @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
328
- softExpectLengthBelowThan(targetData, lengthBelowThan, customErrorMsg = '') {
329
- this.softAssert(() => this.expectLengthBelowThan(targetData, lengthBelowThan, customErrorMsg), customErrorMsg)
330
- }
331
-
332
- /**
333
- Softly asserts that two values are equal, ignoring case.
334
- @param {string} actualValue - The actual string value.
335
- @param {string} expectedValue - The expected string value.
336
- @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
337
- softExpectEqualIgnoreCase(actualValue, expectedValue, customErrorMsg = '') {
338
- this.softAssert(() => this.expectEqualIgnoreCase(actualValue, expectedValue, customErrorMsg), customErrorMsg)
339
- }
340
-
341
- /**
342
- Softly asserts that two arrays have deep equality, considering members in any order.
343
- @param {Array} actualValue - The actual array.
344
- @param {Array} expectedValue - The expected array.
345
- @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
346
- softExpectDeepMembers(actualValue, expectedValue, customErrorMsg = '') {
347
- this.softAssert(() => this.expectDeepMembers(actualValue, expectedValue, customErrorMsg), customErrorMsg)
348
- }
349
-
350
- /**
351
- Softly asserts that an array (superset) deeply includes all members of another array (set).
352
- @param {Array} superset - The array that should contain the expected members.
353
- @param {Array} set - The array with members that should be included.
354
- @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
355
- softExpectDeepIncludeMembers(superset, set, customErrorMsg = '') {
356
- this.softAssert(() => this.expectDeepIncludeMembers(superset, set, customErrorMsg), customErrorMsg)
357
- }
358
-
359
- /**
360
- Softly asserts that two objects are deeply equal, excluding specified fields.
361
- @param {Object} actualValue - The actual object.
362
- @param {Object} expectedValue - The expected object.
363
- @param {Array<string>} fieldsToExclude - The fields to exclude from the comparison.
364
- @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
365
- softExpectDeepEqualExcluding(actualValue, expectedValue, fieldsToExclude, customErrorMsg = '') {
366
- this.softAssert(
367
- () => this.expectDeepEqualExcluding(actualValue, expectedValue, fieldsToExclude, customErrorMsg),
368
- customErrorMsg,
369
- )
370
- }
371
-
372
- /**
373
- Softly asserts that a value matches the expected pattern.
374
- @param {*} actualValue - The actual value.
375
- @param {*} expectedPattern - The pattern the value should match.
376
- @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
377
- softExpectMatchesPattern(actualValue, expectedPattern, customErrorMsg = '') {
378
- this.softAssert(() => this.expectMatchesPattern(actualValue, expectedPattern, customErrorMsg), customErrorMsg)
379
- }
380
- }
381
- module.exports = SoftAssertHelper