@wdio/mocha-framework 7.13.2 → 7.16.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.
package/build/index.d.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="expect-webdriverio/types/standalone" />
2
3
  import Mocha from 'mocha';
3
4
  import type { Capabilities, Services } from '@wdio/types';
4
5
  import type { MochaConfig, MochaOpts as MochaOptsImport, FrameworkMessage, FormattedMessage, MochaContext, MochaError } from './types';
5
6
  import type { EventEmitter } from 'events';
7
+ import type ExpectWebdriverIO from 'expect-webdriverio';
6
8
  declare type EventTypes = 'hook' | 'test' | 'suite';
7
9
  /**
8
10
  * Mocha runner
@@ -51,5 +53,10 @@ declare global {
51
53
  interface MochaOpts extends MochaOptsImport {
52
54
  }
53
55
  }
56
+ namespace NodeJS {
57
+ interface Global {
58
+ expect: ExpectWebdriverIO.Expect;
59
+ }
60
+ }
54
61
  }
55
62
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,KAAiB,MAAM,OAAO,CAAA;AAKrC,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAIzD,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,IAAI,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACtI,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAgB1C,aAAK,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AAG3C;;GAEG;AACH,cAAM,YAAY;IAaV,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,SAAS;IAhBr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O7B,IAAI;IAwBJ,UAAU,CAAE,SAAS,EAAE,eAAe;IAyB5C,QAAQ;IAIF,GAAG;IA8BT,OAAO,CACH,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,YAAY;IAWzB,UAAU,CACN,OAAO,EAAE,KAAK,CAAC,YAAY,EAC3B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,KAAK;IA6BhB;;OAEG;IACH,QAAQ,CAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC,aAAa;IAUhD,cAAc,CAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC,aAAa;IAiBtD,aAAa,CAAE,MAAM,EAAE,gBAAgB;IA2EvC,sBAAsB,CAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,YAAY;IAgBhE,IAAI,CAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,UAAU;IAgBnD,mBAAmB,CAAE,IAAI,EAAE,UAAU;IAUrC,iBAAiB,CAAE,IAAI,EAAE,UAAU;IAOnC,MAAM,CAAE,OAAO,EAAE,gBAAgB;CAwCpC;AAED,QAAA,MAAM,cAAc,EAAE;IAAE,IAAI,CAAC,EAAE,QAAQ,CAAA;CAAO,CAAA;AAS9C,eAAe,cAAc,CAAA;AAC7B,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,CAAA;AAEvC,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,WAAW,CAAC;QAClB,UAAU,SAAU,SAAQ,eAAe;SAAG;KACjD;IACD,UAAU,MAAM,CAAC;QACb,UAAU,MAAM;YACZ,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAA;SACnC;KACJ;CACJ"}
package/build/index.js CHANGED
@@ -11,7 +11,7 @@ const logger_1 = __importDefault(require("@wdio/logger"));
11
11
  const utils_1 = require("@wdio/utils");
12
12
  const utils_2 = require("./utils");
13
13
  const constants_1 = require("./constants");
14
- const log = logger_1.default('@wdio/mocha-framework');
14
+ const log = (0, logger_1.default)('@wdio/mocha-framework');
15
15
  /**
16
16
  * Extracts the mocha UI type following this convention:
17
17
  * - If the mochaOpts.ui provided doesn't contain a '-' then the full name
@@ -96,15 +96,15 @@ class MochaAdapter {
96
96
  try {
97
97
  this._runner = mocha.run(resolve);
98
98
  }
99
- catch (e) {
100
- runtimeError = e;
99
+ catch (err) {
100
+ runtimeError = err;
101
101
  return resolve(1);
102
102
  }
103
103
  Object.keys(constants_1.EVENTS).forEach((e) => this._runner.on(e, this.emit.bind(this, constants_1.EVENTS[e])));
104
104
  this._runner.suite.beforeAll(this.wrapHook('beforeSuite'));
105
105
  this._runner.suite.afterAll(this.wrapHook('afterSuite'));
106
106
  });
107
- await utils_1.executeHooksWithArgs('after', this._config.after, [runtimeError || result, this._capabilities, this._specs]);
107
+ await (0, utils_1.executeHooksWithArgs)('after', this._config.after, [runtimeError || result, this._capabilities, this._specs]);
108
108
  /**
109
109
  * in case the spec has a runtime error throw after the wdio hook
110
110
  */
@@ -131,7 +131,7 @@ class MochaAdapter {
131
131
  constants_1.INTERFACES[type].forEach((fnName) => {
132
132
  let testCommand = constants_1.INTERFACES[type][0];
133
133
  const isTest = [testCommand, testCommand + '.only'].includes(fnName);
134
- utils_1.runTestInFiberContext(isTest, isTest ? this._config.beforeTest : this._config.beforeHook,
134
+ (0, utils_1.runTestInFiberContext)(isTest, isTest ? this._config.beforeTest : this._config.beforeHook,
135
135
  // @ts-ignore
136
136
  hookArgsFn, isTest ? this._config.afterTest : this._config.afterHook, hookArgsFn, fnName, this._cid);
137
137
  });
@@ -141,7 +141,7 @@ class MochaAdapter {
141
141
  * Hooks which are added as true Mocha hooks need to call done() to notify async
142
142
  */
143
143
  wrapHook(hookName) {
144
- return () => utils_1.executeHooksWithArgs(hookName, this._config[hookName], [this.prepareMessage(hookName)]).catch((e) => {
144
+ return () => (0, utils_1.executeHooksWithArgs)(hookName, this._config[hookName], [this.prepareMessage(hookName)]).catch((e) => {
145
145
  log.error(`Error in ${hookName} hook: ${e.stack.slice(7)}`);
146
146
  });
147
147
  }
@@ -171,7 +171,7 @@ class MochaAdapter {
171
171
  * replace "Ensure the done() callback is being called in this test." with a more meaningful message
172
172
  */
173
173
  if (params.err && params.err.message && params.err.message.includes(constants_1.MOCHA_TIMEOUT_MESSAGE)) {
174
- const replacement = util_1.format(constants_1.MOCHA_TIMEOUT_MESSAGE_REPLACEMENT, params.payload.parent.title, params.payload.title);
174
+ const replacement = (0, util_1.format)(constants_1.MOCHA_TIMEOUT_MESSAGE_REPLACEMENT, params.payload.parent.title, params.payload.title);
175
175
  params.err.message = params.err.message.replace(constants_1.MOCHA_TIMEOUT_MESSAGE, replacement);
176
176
  params.err.stack = params.err.stack.replace(constants_1.MOCHA_TIMEOUT_MESSAGE, replacement);
177
177
  }
@@ -234,7 +234,7 @@ class MochaAdapter {
234
234
  if (module.substr(0, 1) === '.') {
235
235
  module = path_1.default.join(process.cwd(), module);
236
236
  }
237
- utils_2.loadModule(module, context);
237
+ (0, utils_2.loadModule)(module, context);
238
238
  });
239
239
  }
240
240
  emit(event, payload, err) {
package/build/utils.js CHANGED
@@ -7,7 +7,7 @@ function loadModule(name, context) {
7
7
  module.context = context;
8
8
  require(name);
9
9
  }
10
- catch (e) {
10
+ catch (err) {
11
11
  throw new Error(`Module ${name} can't get loaded. Are you sure you have installed it?\n` +
12
12
  'Note: if you\'ve installed WebdriverIO globally you need to install ' +
13
13
  'these external modules globally too!');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/mocha-framework",
3
- "version": "7.13.2",
3
+ "version": "7.16.3",
4
4
  "description": "A WebdriverIO plugin. Adapter for Mocha testing framework.",
5
5
  "author": "Christian Bromann <christian@saucelabs.com>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-mocha-framework",
@@ -23,18 +23,18 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@types/mocha": "^9.0.0",
26
- "@wdio/logger": "7.7.0",
27
- "@wdio/types": "7.13.2",
28
- "@wdio/utils": "7.13.2",
26
+ "@wdio/logger": "7.16.0",
27
+ "@wdio/types": "7.16.3",
28
+ "@wdio/utils": "7.16.3",
29
29
  "expect-webdriverio": "^3.0.0",
30
30
  "mocha": "^9.0.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@types/node": "^15.12.5"
33
+ "@types/node": "^16.11.1"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
38
  "types": "./build/index.d.ts",
39
- "gitHead": "1ea2b99e2e335c0fb517c726cd92da970636aaf9"
39
+ "gitHead": "23e2af933060e829f03d7518089c377571c654e3"
40
40
  }