codeceptjs 3.6.6-beta.3 → 3.6.6-beta.5

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.
package/lib/cli.js CHANGED
@@ -145,6 +145,7 @@ class Cli extends Base {
145
145
 
146
146
  result() {
147
147
  const stats = this.stats;
148
+ stats.failedHooks = 0;
148
149
  console.log();
149
150
 
150
151
  // passes
@@ -216,8 +217,14 @@ class Cli extends Base {
216
217
  console.log();
217
218
  }
218
219
 
220
+ this.failures.forEach((failure) => {
221
+ if (failure.constructor.name === 'Hook') {
222
+ stats.failures -= stats.failures
223
+ stats.failedHooks += 1
224
+ }
225
+ })
219
226
  event.emit(event.all.failures, { failuresLog, stats });
220
- output.result(stats.passes, stats.failures, stats.pending, ms(stats.duration));
227
+ output.result(stats.passes, stats.failures, stats.pending, ms(stats.duration), stats.failedHooks);
221
228
 
222
229
  if (stats.failures && output.level() < 3) {
223
230
  output.print(output.styles.debug('Run with --verbose flag to see complete NodeJS stacktrace'));
@@ -264,7 +264,10 @@ function collectStats() {
264
264
  event.dispatcher.on(event.test.passed, () => {
265
265
  stats.passes++;
266
266
  });
267
- event.dispatcher.on(event.test.failed, () => {
267
+ event.dispatcher.on(event.test.failed, (test) => {
268
+ if (test.ctx._runnable.title.includes('hook: AfterSuite')) {
269
+ stats.failedHooks += 1;
270
+ }
268
271
  stats.failures++;
269
272
  });
270
273
  event.dispatcher.on(event.test.skipped, () => {
package/lib/output.js CHANGED
@@ -206,7 +206,7 @@ module.exports = {
206
206
  * @param {number} skipped
207
207
  * @param {number|string} duration
208
208
  */
209
- result(passed, failed, skipped, duration) {
209
+ result(passed, failed, skipped, duration, failedHooks = 0) {
210
210
  let style = colors.bgGreen;
211
211
  let msg = ` ${passed || 0} passed`;
212
212
  let status = style.bold(' OK ');
@@ -215,6 +215,12 @@ module.exports = {
215
215
  status = style.bold(' FAIL ');
216
216
  msg += `, ${failed} failed`;
217
217
  }
218
+
219
+ if (failedHooks > 0) {
220
+ style = style.bgRed;
221
+ status = style.bold(' FAIL ');
222
+ msg += `, ${failedHooks} failedHooks`;
223
+ }
218
224
  status += style.grey(' |');
219
225
 
220
226
  if (skipped) {
package/lib/workers.js CHANGED
@@ -357,6 +357,7 @@ class Workers extends EventEmitter {
357
357
 
358
358
  run() {
359
359
  this.stats.start = new Date();
360
+ this.stats.failedHooks = 0
360
361
  recorder.startUnlessRunning();
361
362
  event.dispatcher.emit(event.workers.before);
362
363
  process.env.RUNS_WITH_WORKERS = 'true';
@@ -471,6 +472,7 @@ class Workers extends EventEmitter {
471
472
  this.stats.failures += newStats.failures;
472
473
  this.stats.tests += newStats.tests;
473
474
  this.stats.pending += newStats.pending;
475
+ this.stats.failedHooks += newStats.failedHooks;
474
476
  }
475
477
 
476
478
  printResults() {
@@ -492,7 +494,7 @@ class Workers extends EventEmitter {
492
494
  this.failuresLog.forEach(log => output.print(...log));
493
495
  }
494
496
 
495
- output.result(this.stats.passes, this.stats.failures, this.stats.pending, ms(this.stats.duration));
497
+ output.result(this.stats.passes, this.stats.failures, this.stats.pending, ms(this.stats.duration), this.stats.failedHooks);
496
498
  process.env.RUNS_WITH_WORKERS = 'false';
497
499
  }
498
500
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "3.6.6-beta.3",
3
+ "version": "3.6.6-beta.5",
4
4
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
5
5
  "keywords": [
6
6
  "acceptance",
@@ -156,7 +156,7 @@
156
156
  "qrcode-terminal": "0.12.0",
157
157
  "rosie": "2.1.1",
158
158
  "runok": "0.9.3",
159
- "semver": "^7.6.3",
159
+ "semver": "7.6.3",
160
160
  "sinon": "18.0.0",
161
161
  "sinon-chai": "3.7.0",
162
162
  "testcafe": "3.5.0",
@@ -1187,6 +1187,8 @@ declare namespace CodeceptJS {
1187
1187
  // @ts-ignore
1188
1188
  // @ts-ignore
1189
1189
  // @ts-ignore
1190
+ // @ts-ignore
1191
+ // @ts-ignore
1190
1192
  class ExpectHelper {
1191
1193
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1192
1194
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
@@ -1305,6 +1307,8 @@ declare namespace CodeceptJS {
1305
1307
  // @ts-ignore
1306
1308
  // @ts-ignore
1307
1309
  // @ts-ignore
1310
+ // @ts-ignore
1311
+ // @ts-ignore
1308
1312
  class ExpectHelper {
1309
1313
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1310
1314
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
@@ -1983,6 +1987,8 @@ declare namespace CodeceptJS {
1983
1987
  // @ts-ignore
1984
1988
  // @ts-ignore
1985
1989
  // @ts-ignore
1990
+ // @ts-ignore
1991
+ // @ts-ignore
1986
1992
  type MockServerConfig = {
1987
1993
  port?: number;
1988
1994
  host?: string;
@@ -2114,6 +2120,8 @@ declare namespace CodeceptJS {
2114
2120
  // @ts-ignore
2115
2121
  // @ts-ignore
2116
2122
  // @ts-ignore
2123
+ // @ts-ignore
2124
+ // @ts-ignore
2117
2125
  class MockServer {
2118
2126
  /**
2119
2127
  * Start the mock server
@@ -3194,6 +3202,8 @@ declare namespace CodeceptJS {
3194
3202
  // @ts-ignore
3195
3203
  // @ts-ignore
3196
3204
  // @ts-ignore
3205
+ // @ts-ignore
3206
+ // @ts-ignore
3197
3207
  type PlaywrightConfig = {
3198
3208
  url?: string;
3199
3209
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -6577,6 +6587,8 @@ declare namespace CodeceptJS {
6577
6587
  // @ts-ignore
6578
6588
  // @ts-ignore
6579
6589
  // @ts-ignore
6590
+ // @ts-ignore
6591
+ // @ts-ignore
6580
6592
  type PuppeteerConfig = {
6581
6593
  url: string;
6582
6594
  basicAuth?: any;
@@ -8390,6 +8402,8 @@ declare namespace CodeceptJS {
8390
8402
  // @ts-ignore
8391
8403
  // @ts-ignore
8392
8404
  // @ts-ignore
8405
+ // @ts-ignore
8406
+ // @ts-ignore
8393
8407
  type RESTConfig = {
8394
8408
  endpoint?: string;
8395
8409
  prettyPrintJson?: boolean;
@@ -9759,6 +9773,8 @@ declare namespace CodeceptJS {
9759
9773
  // @ts-ignore
9760
9774
  // @ts-ignore
9761
9775
  // @ts-ignore
9776
+ // @ts-ignore
9777
+ // @ts-ignore
9762
9778
  type WebDriverConfig = {
9763
9779
  url: string;
9764
9780
  browser: string;
@@ -1211,6 +1211,8 @@ declare namespace CodeceptJS {
1211
1211
  // @ts-ignore
1212
1212
  // @ts-ignore
1213
1213
  // @ts-ignore
1214
+ // @ts-ignore
1215
+ // @ts-ignore
1214
1216
  class ExpectHelper {
1215
1217
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1216
1218
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
@@ -1329,6 +1331,8 @@ declare namespace CodeceptJS {
1329
1331
  // @ts-ignore
1330
1332
  // @ts-ignore
1331
1333
  // @ts-ignore
1334
+ // @ts-ignore
1335
+ // @ts-ignore
1332
1336
  class ExpectHelper {
1333
1337
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1334
1338
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
@@ -2010,6 +2014,8 @@ declare namespace CodeceptJS {
2010
2014
  // @ts-ignore
2011
2015
  // @ts-ignore
2012
2016
  // @ts-ignore
2017
+ // @ts-ignore
2018
+ // @ts-ignore
2013
2019
  type MockServerConfig = {
2014
2020
  port?: number;
2015
2021
  host?: string;
@@ -2141,6 +2147,8 @@ declare namespace CodeceptJS {
2141
2147
  // @ts-ignore
2142
2148
  // @ts-ignore
2143
2149
  // @ts-ignore
2150
+ // @ts-ignore
2151
+ // @ts-ignore
2144
2152
  class MockServer {
2145
2153
  /**
2146
2154
  * Start the mock server
@@ -3287,6 +3295,8 @@ declare namespace CodeceptJS {
3287
3295
  // @ts-ignore
3288
3296
  // @ts-ignore
3289
3297
  // @ts-ignore
3298
+ // @ts-ignore
3299
+ // @ts-ignore
3290
3300
  type PlaywrightConfig = {
3291
3301
  url?: string;
3292
3302
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -6821,6 +6831,8 @@ declare namespace CodeceptJS {
6821
6831
  // @ts-ignore
6822
6832
  // @ts-ignore
6823
6833
  // @ts-ignore
6834
+ // @ts-ignore
6835
+ // @ts-ignore
6824
6836
  type PuppeteerConfig = {
6825
6837
  url: string;
6826
6838
  basicAuth?: any;
@@ -8770,6 +8782,8 @@ declare namespace CodeceptJS {
8770
8782
  // @ts-ignore
8771
8783
  // @ts-ignore
8772
8784
  // @ts-ignore
8785
+ // @ts-ignore
8786
+ // @ts-ignore
8773
8787
  type RESTConfig = {
8774
8788
  endpoint?: string;
8775
8789
  prettyPrintJson?: boolean;
@@ -10199,6 +10213,8 @@ declare namespace CodeceptJS {
10199
10213
  // @ts-ignore
10200
10214
  // @ts-ignore
10201
10215
  // @ts-ignore
10216
+ // @ts-ignore
10217
+ // @ts-ignore
10202
10218
  type WebDriverConfig = {
10203
10219
  url: string;
10204
10220
  browser: string;