codeceptjs 3.7.0-beta.2 → 3.7.0-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.
@@ -3,6 +3,7 @@ const output = require('../output')
3
3
  const recorder = require('../recorder')
4
4
  const Config = require('../config')
5
5
  const { timeouts } = require('../store')
6
+ const debug = require('debug')('codeceptjs:timeout')
6
7
  const TIMEOUT_ORDER = require('../step').TIMEOUT_ORDER
7
8
 
8
9
  module.exports = function () {
@@ -17,10 +18,11 @@ module.exports = function () {
17
18
  }
18
19
 
19
20
  event.dispatcher.on(event.suite.before, suite => {
20
- timeout = null;
21
21
  suiteTimeout = []
22
22
  let timeoutConfig = Config.get('timeout')
23
23
 
24
+ debug('config:', timeoutConfig || 'none')
25
+
24
26
  if (timeoutConfig) {
25
27
  if (!Number.isNaN(+timeoutConfig)) {
26
28
  checkForSeconds(timeoutConfig)
@@ -39,8 +41,10 @@ module.exports = function () {
39
41
  }
40
42
  }
41
43
 
44
+ debug('current suite timeout:', suite.totalTimeout || 'none');
42
45
  if (suite.totalTimeout) suiteTimeout.push(suite.totalTimeout)
43
46
  output.log(`Timeouts: ${suiteTimeout}`)
47
+ debug('active timeouts', suiteTimeout)
44
48
  })
45
49
 
46
50
  event.dispatcher.on(event.test.before, test => {
@@ -82,8 +86,10 @@ module.exports = function () {
82
86
  if (typeof timeout !== 'number') return
83
87
 
84
88
  if (timeout < 0) {
89
+ debug('Previous steps timed out, setting timeout to 0.01s');
85
90
  step.setTimeout(0.01, TIMEOUT_ORDER.testOrSuite)
86
91
  } else {
92
+ debug(`Setting timeout ${timeout}ms for step ${step.toCode().trim()}`);
87
93
  step.setTimeout(timeout, TIMEOUT_ORDER.testOrSuite)
88
94
  }
89
95
  })
@@ -92,7 +98,9 @@ module.exports = function () {
92
98
  if (typeof timeout === 'number' && !Number.isNaN(timeout)) timeout -= step.duration
93
99
 
94
100
  if (typeof timeout === 'number' && timeout <= 0 && recorder.isRunning()) {
101
+ debug(`step ${step.toCode().trim()} timed out`);
95
102
  if (currentTest && currentTest.callback) {
103
+ debug(`Failing test ${currentTest.title} with timeout ${currentTimeout}s`);
96
104
  recorder.reset()
97
105
  // replace mocha timeout with custom timeout
98
106
  currentTest.timeout(0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "3.7.0-beta.2",
3
+ "version": "3.7.0-beta.3",
4
4
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
5
5
  "keywords": [
6
6
  "acceptance",
@@ -1779,6 +1779,7 @@ declare namespace CodeceptJS {
1779
1779
  // @ts-ignore
1780
1780
  // @ts-ignore
1781
1781
  // @ts-ignore
1782
+ // @ts-ignore
1782
1783
  type MockServerConfig = {
1783
1784
  port?: number;
1784
1785
  host?: string;
@@ -1917,6 +1918,7 @@ declare namespace CodeceptJS {
1917
1918
  // @ts-ignore
1918
1919
  // @ts-ignore
1919
1920
  // @ts-ignore
1921
+ // @ts-ignore
1920
1922
  class MockServer {
1921
1923
  /**
1922
1924
  * Start the mock server
@@ -2964,6 +2966,7 @@ declare namespace CodeceptJS {
2964
2966
  // @ts-ignore
2965
2967
  // @ts-ignore
2966
2968
  // @ts-ignore
2969
+ // @ts-ignore
2967
2970
  type PlaywrightConfig = {
2968
2971
  url?: string;
2969
2972
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -6354,6 +6357,7 @@ declare namespace CodeceptJS {
6354
6357
  // @ts-ignore
6355
6358
  // @ts-ignore
6356
6359
  // @ts-ignore
6360
+ // @ts-ignore
6357
6361
  type PuppeteerConfig = {
6358
6362
  url: string;
6359
6363
  basicAuth?: any;
@@ -8174,6 +8178,7 @@ declare namespace CodeceptJS {
8174
8178
  // @ts-ignore
8175
8179
  // @ts-ignore
8176
8180
  // @ts-ignore
8181
+ // @ts-ignore
8177
8182
  type RESTConfig = {
8178
8183
  endpoint?: string;
8179
8184
  prettyPrintJson?: boolean;
@@ -9332,6 +9337,7 @@ declare namespace CodeceptJS {
9332
9337
  // @ts-ignore
9333
9338
  // @ts-ignore
9334
9339
  // @ts-ignore
9340
+ // @ts-ignore
9335
9341
  type WebDriverConfig = {
9336
9342
  url: string;
9337
9343
  browser: string;
@@ -1806,6 +1806,7 @@ declare namespace CodeceptJS {
1806
1806
  // @ts-ignore
1807
1807
  // @ts-ignore
1808
1808
  // @ts-ignore
1809
+ // @ts-ignore
1809
1810
  type MockServerConfig = {
1810
1811
  port?: number;
1811
1812
  host?: string;
@@ -1944,6 +1945,7 @@ declare namespace CodeceptJS {
1944
1945
  // @ts-ignore
1945
1946
  // @ts-ignore
1946
1947
  // @ts-ignore
1948
+ // @ts-ignore
1947
1949
  class MockServer {
1948
1950
  /**
1949
1951
  * Start the mock server
@@ -3057,6 +3059,7 @@ declare namespace CodeceptJS {
3057
3059
  // @ts-ignore
3058
3060
  // @ts-ignore
3059
3061
  // @ts-ignore
3062
+ // @ts-ignore
3060
3063
  type PlaywrightConfig = {
3061
3064
  url?: string;
3062
3065
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -6598,6 +6601,7 @@ declare namespace CodeceptJS {
6598
6601
  // @ts-ignore
6599
6602
  // @ts-ignore
6600
6603
  // @ts-ignore
6604
+ // @ts-ignore
6601
6605
  type PuppeteerConfig = {
6602
6606
  url: string;
6603
6607
  basicAuth?: any;
@@ -8554,6 +8558,7 @@ declare namespace CodeceptJS {
8554
8558
  // @ts-ignore
8555
8559
  // @ts-ignore
8556
8560
  // @ts-ignore
8561
+ // @ts-ignore
8557
8562
  type RESTConfig = {
8558
8563
  endpoint?: string;
8559
8564
  prettyPrintJson?: boolean;
@@ -9772,6 +9777,7 @@ declare namespace CodeceptJS {
9772
9777
  // @ts-ignore
9773
9778
  // @ts-ignore
9774
9779
  // @ts-ignore
9780
+ // @ts-ignore
9775
9781
  type WebDriverConfig = {
9776
9782
  url: string;
9777
9783
  browser: string;