@wdio/runner 8.0.0-alpha.412 → 8.0.0-alpha.504

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.
@@ -0,0 +1,29 @@
1
+ import type { Capabilities } from '@wdio/types';
2
+ import type BaseReporter from './reporter';
3
+ import type { TestFramework } from './types';
4
+ declare type WDIOErrorEvent = Pick<ErrorEvent, 'filename' | 'message'>;
5
+ declare global {
6
+ interface Window {
7
+ __wdioErrors__: WDIOErrorEvent[];
8
+ __wdioEvents__: any[];
9
+ __wdioFailures__: number;
10
+ }
11
+ }
12
+ export default class BrowserFramework implements Omit<TestFramework, 'init'> {
13
+ #private;
14
+ private _cid;
15
+ private _config;
16
+ private _specs;
17
+ private _capabilities;
18
+ private _reporter;
19
+ constructor(_cid: string, _config: unknown, _specs: string[], _capabilities: Capabilities.RemoteCapability, _reporter: BaseReporter);
20
+ /**
21
+ * always return true as it is unrelevant for component testing
22
+ */
23
+ hasTests(): boolean;
24
+ init(): TestFramework;
25
+ run(): Promise<number>;
26
+ static init(cid: string, config: unknown, specs: string[], caps: Capabilities.RemoteCapability, reporter: BaseReporter): BrowserFramework;
27
+ }
28
+ export {};
29
+ //# sourceMappingURL=browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,OAAO,KAAK,YAAY,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAK5C,aAAK,cAAc,GAAG,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC,CAAA;AAE9D,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,cAAc,EAAE,cAAc,EAAE,CAAA;QAChC,cAAc,EAAE,GAAG,EAAE,CAAA;QACrB,gBAAgB,EAAE,MAAM,CAAA;KAC3B;CACJ;AAED,MAAM,CAAC,OAAO,OAAO,gBAAiB,YAAW,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC;;IAEpE,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,SAAS;gBAJT,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EAAE,EAChB,aAAa,EAAE,YAAY,CAAC,gBAAgB,EAC5C,SAAS,EAAE,YAAY;IAGnC;;OAEG;IACH,QAAQ;IAIR,IAAI;IAIE,GAAG;IAiFT,MAAM,CAAC,IAAI,CAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,YAAY,CAAC,gBAAgB,EAAE,QAAQ,EAAE,YAAY;CAI1H"}
@@ -0,0 +1,104 @@
1
+ import url from 'node:url';
2
+ import path from 'node:path';
3
+ import logger from '@wdio/logger';
4
+ import { browser } from '@wdio/globals';
5
+ const log = logger('@wdio/runner');
6
+ const sep = '\n - ';
7
+ export default class BrowserFramework {
8
+ _cid;
9
+ _config;
10
+ _specs;
11
+ _capabilities;
12
+ _reporter;
13
+ constructor(_cid, _config, _specs, _capabilities, _reporter) {
14
+ this._cid = _cid;
15
+ this._config = _config;
16
+ this._specs = _specs;
17
+ this._capabilities = _capabilities;
18
+ this._reporter = _reporter;
19
+ }
20
+ /**
21
+ * always return true as it is unrelevant for component testing
22
+ */
23
+ hasTests() {
24
+ return true;
25
+ }
26
+ init() {
27
+ return undefined;
28
+ }
29
+ async run() {
30
+ try {
31
+ const failures = await this.#loop();
32
+ return failures;
33
+ }
34
+ catch (err) {
35
+ log.error(`Failed to run browser tests with cid ${this._cid}: ${err.stack}`);
36
+ return 1;
37
+ }
38
+ }
39
+ async #loop() {
40
+ /**
41
+ * start tests
42
+ */
43
+ let failures = 0;
44
+ for (const spec of this._specs) {
45
+ log.info(`Run spec file ${spec} for cid ${this._cid}`);
46
+ console.log(`Run spec file ${spec} for cid ${this._cid}`);
47
+ await browser.url(`/${this._cid}/test.html?spec=${url.fileURLToPath(spec)}`);
48
+ // await browser.debug()
49
+ /**
50
+ * fetch page errors that are thrown during rendering and let spec file fail
51
+ */
52
+ const jsErrors = (await browser.execute(() => window.__wdioErrors__)) || ([]);
53
+ if (jsErrors.length) {
54
+ const errors = jsErrors.map((ev) => `${path.basename(ev.filename)}: ${ev.message}`);
55
+ const envError = new Error(`Test failed due to following error(s):${sep}${errors.join(sep)}`);
56
+ this._reporter.emit('error', {
57
+ cid: this._cid,
58
+ name: 'error',
59
+ content: envError.message
60
+ });
61
+ failures += 1;
62
+ continue;
63
+ }
64
+ failures += await this.#fetchEvents(browser, spec);
65
+ }
66
+ return failures;
67
+ }
68
+ async #fetchEvents(browser, spec) {
69
+ /**
70
+ * wait until tests have finished and results are emitted to the window scope
71
+ */
72
+ let failures = null;
73
+ await browser.waitUntil(async () => {
74
+ while (typeof failures !== 'number') {
75
+ failures = await browser?.execute(() => (window.__wdioEvents__.length > 0
76
+ ? window.__wdioFailures__
77
+ : null));
78
+ }
79
+ return true;
80
+ }, {
81
+ timeoutMsg: 'browser test timed out'
82
+ });
83
+ /**
84
+ * populate events to the reporter
85
+ */
86
+ const events = await browser.execute(() => window.__wdioEvents__);
87
+ for (const ev of events) {
88
+ if ((ev.type === 'suite:start' || ev.type === 'suite:end') && ev.title === '') {
89
+ continue;
90
+ }
91
+ this._reporter.emit(ev.type, {
92
+ ...ev,
93
+ file: spec,
94
+ uid: this._cid,
95
+ cid: this._cid
96
+ });
97
+ }
98
+ return failures;
99
+ }
100
+ static init(cid, config, specs, caps, reporter) {
101
+ const framework = new BrowserFramework(cid, config, specs, caps, reporter);
102
+ return framework;
103
+ }
104
+ }
package/build/index.d.ts CHANGED
@@ -1,24 +1,12 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from 'node:events';
3
- import type { Options, Capabilities } from '@wdio/types';
4
- interface Args extends Partial<Options.Testrunner> {
5
- ignoredWorkerServices?: string[];
6
- watch?: boolean;
7
- }
8
- declare type RunParams = {
9
- cid: string;
10
- args: Args;
11
- specs: string[];
12
- caps: Capabilities.RemoteCapability;
13
- configFile: string;
14
- retries: number;
15
- };
3
+ import type { RunParams } from './types';
16
4
  export default class Runner extends EventEmitter {
5
+ #private;
17
6
  private _browser?;
18
7
  private _configParser;
19
8
  private _sigintWasCalled;
20
9
  private _isMultiremote;
21
- private _hadRunnerStartEvent;
22
10
  private _specFileRetryAttempts;
23
11
  private _reporter?;
24
12
  private _framework?;
@@ -66,5 +54,6 @@ export default class Runner extends EventEmitter {
66
54
  */
67
55
  endSession(): Promise<void>;
68
56
  }
69
- export {};
57
+ export { default as BaseReporter } from './reporter.js';
58
+ export * from './types.js';
70
59
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAO1C,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAY,MAAM,aAAa,CAAA;AAalE,UAAU,IAAK,SAAQ,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;IAC9C,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAA;IAChC,KAAK,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,aAAK,SAAS,GAAG;IACb,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,IAAI,CAAA;IACV,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,IAAI,EAAE,YAAY,CAAC,gBAAgB,CAAA;IACnC,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;CAClB,CAAA;AAkBD,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,YAAY;IAC5C,OAAO,CAAC,QAAQ,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,CAAC,MAAM,CAAC,CAAU;IACzB,OAAO,CAAC,KAAK,CAAC,CAA+B;IAE7C;;;;;;;;;OASG;IACG,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,SAAS;IA4LpE;;;;;;OAMG;YACW,YAAY;IA6C1B;;;;;OAKG;YACW,aAAa;IAiC3B;;OAEG;YACW,gBAAgB;IA8D9B;;OAEG;YACW,SAAS;IAmCvB;;;OAGG;IACG,UAAU;CA2DnB;AAED,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,eAAe,CAAA;AACvD,cAAc,YAAY,CAAA"}
package/build/index.js CHANGED
@@ -6,6 +6,7 @@ import { initialiseWorkerService, initialisePlugin, executeHooksWithArgs } from
6
6
  import { ConfigParser } from '@wdio/config';
7
7
  import { _setGlobal } from '@wdio/globals';
8
8
  import { expect, setOptions } from 'expect-webdriverio';
9
+ import BrowserFramework from './browser.js';
9
10
  import BaseReporter from './reporter.js';
10
11
  import { initialiseInstance, filterLogTypes, getInstancesData } from './utils.js';
11
12
  const log = logger('@wdio/runner');
@@ -14,7 +15,6 @@ export default class Runner extends EventEmitter {
14
15
  _configParser = new ConfigParser();
15
16
  _sigintWasCalled = false;
16
17
  _isMultiremote = false;
17
- _hadRunnerStartEvent = false;
18
18
  _specFileRetryAttempts = 0;
19
19
  _reporter;
20
20
  _framework;
@@ -78,8 +78,7 @@ export default class Runner extends EventEmitter {
78
78
  /**
79
79
  * initialise framework
80
80
  */
81
- this._framework = (await initialisePlugin(this._config.framework, 'framework')).default;
82
- this._framework = await this._framework.init(cid, this._config, specs, caps, this._reporter);
81
+ this._framework = await this.#initFramework(cid, this._config, caps, this._reporter, specs);
83
82
  process.send({ name: 'testFrameworkInit', content: { cid, caps, specs, hasTests: this._framework.hasTests() } });
84
83
  if (!this._framework.hasTests()) {
85
84
  return this._shutdown(0, retries, true);
@@ -132,7 +131,6 @@ export default class Runner extends EventEmitter {
132
131
  : { ...browser.capabilities, sessionId: browser.sessionId },
133
132
  retry: this._specFileRetryAttempts
134
133
  });
135
- this._hadRunnerStartEvent = true;
136
134
  /**
137
135
  * report sessionId and target connection information to worker
138
136
  */
@@ -142,7 +140,11 @@ export default class Runner extends EventEmitter {
142
140
  process.send({
143
141
  origin: 'worker',
144
142
  name: 'sessionStarted',
145
- content: { sessionId, isW3C, protocol, hostname, port, path, queryParams, isMultiremote, instances }
143
+ content: {
144
+ sessionId, isW3C, protocol, hostname, port, path, queryParams, isMultiremote, instances,
145
+ capabilities: browser.capabilities,
146
+ injectGlobals: this._config.injectGlobals
147
+ }
146
148
  });
147
149
  /**
148
150
  * kick off tests in framework
@@ -165,6 +167,24 @@ export default class Runner extends EventEmitter {
165
167
  }
166
168
  return this._shutdown(failures, retries);
167
169
  }
170
+ async #initFramework(cid, config, capabilities, reporter, specs) {
171
+ const runner = Array.isArray(config.runner) ? config.runner[0] : config.runner;
172
+ /**
173
+ * initialise framework adapter when running remote browser tests
174
+ */
175
+ if (runner === 'local') {
176
+ const framework = (await initialisePlugin(config.framework, 'framework')).default;
177
+ return framework.init(cid, config, specs, capabilities, reporter);
178
+ }
179
+ /**
180
+ * for embedded browser tests the `@wdio/browser-runner` already has the environment
181
+ * setup so we can just run through the tests
182
+ */
183
+ if (runner === 'browser') {
184
+ return BrowserFramework.init(cid, config, specs, capabilities, reporter);
185
+ }
186
+ throw new Error(`Unknown runner "${runner}"`);
187
+ }
168
188
  /**
169
189
  * init protocol session
170
190
  * @param {object} config configuration of sessions
@@ -356,6 +376,11 @@ export default class Runner extends EventEmitter {
356
376
  });
357
377
  }
358
378
  await this._browser?.deleteSession();
379
+ process.send({
380
+ origin: 'worker',
381
+ name: 'sessionEnded',
382
+ cid: this._cid
383
+ });
359
384
  /**
360
385
  * delete session(s)
361
386
  */
@@ -372,3 +397,5 @@ export default class Runner extends EventEmitter {
372
397
  await executeHooksWithArgs('afterSession', this._config.afterSession, afterSessionArgs);
373
398
  }
374
399
  }
400
+ export { default as BaseReporter } from './reporter.js';
401
+ export * from './types.js';
@@ -5,10 +5,12 @@ import type { Options, Capabilities } from '@wdio/types';
5
5
  * to all these reporters
6
6
  */
7
7
  export default class BaseReporter {
8
+ #private;
8
9
  private _config;
9
10
  private _cid;
10
11
  caps: Capabilities.RemoteCapability;
11
12
  private _reporters;
13
+ private listeners;
12
14
  constructor(_config: Options.Testrunner, _cid: string, caps: Capabilities.RemoteCapability);
13
15
  initReporters(): Promise<void>;
14
16
  /**
@@ -18,6 +20,7 @@ export default class BaseReporter {
18
20
  * @param {object} payload event payload
19
21
  */
20
22
  emit(e: string, payload: any): void;
23
+ onMessage(listener: (ev: any) => void): void;
21
24
  getLogFile(name: string): string | undefined;
22
25
  /**
23
26
  * return write stream object based on reporter name
@@ -1 +1 @@
1
- {"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../src/reporter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAa,MAAM,aAAa,CAAA;AAMnE;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,YAAY;IAIzB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,IAAI;IACL,IAAI,EAAE,YAAY,CAAC,gBAAgB;IAL9C,OAAO,CAAC,UAAU,CAAmC;gBAGzC,OAAO,EAAE,OAAO,CAAC,UAAU,EAC3B,IAAI,EAAE,MAAM,EACb,IAAI,EAAE,YAAY,CAAC,gBAAgB;IAGxC,aAAa;IAMnB;;;;;OAKG;IACH,IAAI,CAAE,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG;IAW7B,UAAU,CAAE,IAAI,EAAE,MAAM;IAoCxB;;OAEG;IACH,oBAAoB,CAAE,QAAQ,EAAE,MAAM;yBAEc,OAAO;;IAQ3D;;;OAGG;IACH,WAAW;IA2BX;;OAEG;YACW,aAAa;CAoE9B"}
1
+ {"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../src/reporter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAa,MAAM,aAAa,CAAA;AAKnE;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,YAAY;;IAKzB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,IAAI;IACL,IAAI,EAAE,YAAY,CAAC,gBAAgB;IAN9C,OAAO,CAAC,UAAU,CAAmC;IACrD,OAAO,CAAC,SAAS,CAA4B;gBAGjC,OAAO,EAAE,OAAO,CAAC,UAAU,EAC3B,IAAI,EAAE,MAAM,EACb,IAAI,EAAE,YAAY,CAAC,gBAAgB;IAGxC,aAAa;IAMnB;;;;;OAKG;IACH,IAAI,CAAE,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG;IAuB7B,SAAS,CAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,GAAG,KAAK,IAAI;IAItC,UAAU,CAAE,IAAI,EAAE,MAAM;IAoCxB;;OAEG;IACH,oBAAoB,CAAE,QAAQ,EAAE,MAAM;yBAEc,OAAO;;IAoB3D;;;OAGG;IACH,WAAW;IA2BX;;OAEG;YACW,aAAa;CAoE9B"}
package/build/reporter.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import path from 'node:path';
2
2
  import logger from '@wdio/logger';
3
3
  import { initialisePlugin } from '@wdio/utils';
4
- import { sendFailureMessage } from './utils.js';
5
4
  const log = logger('@wdio/runner');
5
+ const mochaAllHooks = ['"before all" hook', '"after all" hook'];
6
6
  /**
7
7
  * BaseReporter
8
8
  * responsible for initialising reporters for every testrun and propagating events
@@ -13,6 +13,7 @@ export default class BaseReporter {
13
13
  _cid;
14
14
  caps;
15
15
  _reporters = [];
16
+ listeners = [];
16
17
  constructor(_config, _cid, caps) {
17
18
  this._config = _config;
18
19
  this._cid = _cid;
@@ -32,9 +33,22 @@ export default class BaseReporter {
32
33
  /**
33
34
  * Send failure message (only once) in case of test or hook failure
34
35
  */
35
- sendFailureMessage(e, payload);
36
+ const isTestError = e === 'test:fail';
37
+ const isHookError = (e === 'hook:end' &&
38
+ payload.error &&
39
+ mochaAllHooks.some(hook => payload.title.startsWith(hook)));
40
+ if (isTestError || isHookError) {
41
+ this.#emitData({
42
+ origin: 'reporter',
43
+ name: 'printFailureMessage',
44
+ content: payload
45
+ });
46
+ }
36
47
  this._reporters.forEach((reporter) => reporter.emit(e, payload));
37
48
  }
49
+ onMessage(listener) {
50
+ this.listeners.push(listener);
51
+ }
38
52
  getLogFile(name) {
39
53
  // clone the config to avoid changing original properties
40
54
  let options = Object.assign({}, this._config);
@@ -64,13 +78,23 @@ export default class BaseReporter {
64
78
  */
65
79
  getWriteStreamObject(reporter) {
66
80
  return {
67
- write: /* istanbul ignore next */ (content) => process.send({
81
+ write: /* istanbul ignore next */ (content) => this.#emitData({
68
82
  origin: 'reporter',
69
83
  name: reporter,
70
84
  content
71
85
  })
72
86
  };
73
87
  }
88
+ /**
89
+ * emit data either through process or listener
90
+ */
91
+ #emitData(payload) {
92
+ if (typeof process.send === 'function') {
93
+ return process.send(payload);
94
+ }
95
+ this.listeners.forEach((fn) => fn(payload));
96
+ return true;
97
+ }
74
98
  /**
75
99
  * wait for reporter to finish synchronization, e.g. when sending data asynchronous
76
100
  * to a server (e.g. sumo reporter)
@@ -0,0 +1,54 @@
1
+ import type { Options, Capabilities, Services } from '@wdio/types';
2
+ import BaseReporter from './reporter.js';
3
+ export declare type BeforeArgs = Parameters<Required<Services.HookFunctions>['before']>;
4
+ export declare type AfterArgs = Parameters<Required<Services.HookFunctions>['after']>;
5
+ export declare type BeforeSessionArgs = Parameters<Required<Services.HookFunctions>['beforeSession']>;
6
+ export declare type AfterSessionArgs = Parameters<Required<Services.HookFunctions>['afterSession']>;
7
+ interface Args extends Partial<Options.Testrunner> {
8
+ ignoredWorkerServices?: string[];
9
+ watch?: boolean;
10
+ }
11
+ export declare type RunParams = {
12
+ cid: string;
13
+ args: Args;
14
+ specs: string[];
15
+ caps: Capabilities.RemoteCapability;
16
+ configFile: string;
17
+ retries: number;
18
+ };
19
+ export interface TestFramework {
20
+ init: (cid: string, config: Options.Testrunner, specs: string[], capabilities: Capabilities.RemoteCapability, reporter: BaseReporter) => TestFramework;
21
+ run(): Promise<number>;
22
+ hasTests(): boolean;
23
+ }
24
+ declare type SingleCapability = {
25
+ capabilities: Capabilities.RemoteCapability;
26
+ };
27
+ export interface SingleConfigOption extends Omit<Options.Testrunner, 'capabilities'>, SingleCapability {
28
+ }
29
+ export declare type MultiRemoteCaps = Record<string, (Capabilities.DesiredCapabilities | Capabilities.W3CCapabilities) & {
30
+ sessionId?: string;
31
+ }>;
32
+ export interface SessionStartedMessage {
33
+ origin: 'worker';
34
+ name: 'sessionStarted';
35
+ content: {
36
+ sessionId: string;
37
+ isW3C: boolean;
38
+ protocol: string;
39
+ hostname: string;
40
+ port: number;
41
+ path: string;
42
+ isMultiremote: boolean;
43
+ injectGlobals: boolean;
44
+ capabilities: Capabilities.Capabilities;
45
+ };
46
+ cid?: string;
47
+ }
48
+ export interface SessionEndedMessage {
49
+ origin: 'worker';
50
+ name: 'sessionEnded';
51
+ cid: string;
52
+ }
53
+ export {};
54
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAClE,OAAO,YAAY,MAAM,eAAe,CAAA;AAExC,oBAAY,UAAU,GAAG,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAA;AAC/E,oBAAY,SAAS,GAAG,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;AAC7E,oBAAY,iBAAiB,GAAG,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,eAA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EAAE,gBAAgB,CAAA;IACtB,OAAO,EAAE;QACL,SAAS,EAAE,MAAM,CAAA;QACjB,KAAK,EAAE,OAAO,CAAA;QACd,QAAQ,EAAE,MAAM,CAAA;QAChB,QAAQ,EAAE,MAAM,CAAA;QAChB,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,aAAa,EAAE,OAAO,CAAA;QACtB,aAAa,EAAE,OAAO,CAAA;QACtB,YAAY,EAAE,YAAY,CAAC,YAAY,CAAA;KAC1C,CAAC;IACF,GAAG,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,mBAAmB;IAChC,MAAM,EAAE,QAAQ,CAAA;IAChB,IAAI,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAA;CACd"}
package/build/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/build/utils.d.ts CHANGED
@@ -25,12 +25,6 @@ export declare function initialiseInstance(config: ConfigWithSessionId, capabili
25
25
  * @return {string[]} logTypes
26
26
  */
27
27
  export declare function filterLogTypes(excludeDriverLogs: string[], driverLogTypes: string[]): string[];
28
- /**
29
- * Send event to WDIOCLInterface if test or before/after all hook failed
30
- * @param {string} e event
31
- * @param {object} payload payload
32
- */
33
- export declare function sendFailureMessage(e: string, payload: any): void;
34
28
  declare type BrowserData = {
35
29
  sessionId: string;
36
30
  isW3C: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAO9D,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC,gB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AAA;AAM9D,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC,gBAAgB,CAAA;CAC9C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CACxB,IAAI,EAAE,YAAY,CAAC,gBAAgB,EACnC,SAAS,CAAC,EAAE,OAAO,GACpB,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAoBjD;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACpC,MAAM,EAAE,mBAAmB,EAC3B,YAAY,EAAE,YAAY,CAAC,gBAAgB,EAC3C,aAAa,CAAC,EAAE,OAAO,GACxB,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC,CA4CzD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC1B,iBAAiB,EAAE,MAAM,EAAE,EAC3B,cAAc,EAAE,MAAM,EAAE,YAiB3B;AAED,aAAK,WAAW,GAAG;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,OAAO,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACtC,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC5B,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,kBAAkB,CAAC,OAAO,CAAC,EACvD,aAAa,EAAE,OAAO,oDAgBzB"}
package/build/utils.js CHANGED
@@ -3,9 +3,8 @@ import logger from '@wdio/logger';
3
3
  import { remote, multiremote, attach } from 'webdriverio';
4
4
  import { DEFAULTS } from 'webdriver';
5
5
  import { DEFAULT_CONFIGS } from '@wdio/config';
6
- const log = logger('@wdio/local-runner:utils');
6
+ const log = logger('@wdio/runner');
7
7
  const MERGE_OPTIONS = { clone: false };
8
- const mochaAllHooks = ['"before all" hook', '"after all" hook'];
9
8
  /**
10
9
  * sanitizes wdio config from capability properties
11
10
  * @param {Object} caps desired session capabilities
@@ -90,23 +89,6 @@ export function filterLogTypes(excludeDriverLogs, driverLogTypes) {
90
89
  }
91
90
  return logTypes;
92
91
  }
93
- /**
94
- * Send event to WDIOCLInterface if test or before/after all hook failed
95
- * @param {string} e event
96
- * @param {object} payload payload
97
- */
98
- export function sendFailureMessage(e, payload) {
99
- if (e === 'test:fail' ||
100
- (e === 'hook:end' &&
101
- payload.error &&
102
- mochaAllHooks.some(hook => payload.title.startsWith(hook)))) {
103
- process.send({
104
- origin: 'reporter',
105
- name: 'printFailureMessage',
106
- content: payload
107
- });
108
- }
109
- }
110
92
  /**
111
93
  * Gets { sessionId, isW3C, protocol, hostname, port, path, queryParams } of every Multiremote instance
112
94
  * @param {object} browser browser
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/runner",
3
- "version": "8.0.0-alpha.412+a2bc7ec67",
3
+ "version": "8.0.0-alpha.504+428a9d729",
4
4
  "description": "A WebdriverIO service that runs tests in arbitrary environments",
5
5
  "author": "Christian Bromann <mail@bromann.dev>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-runner",
@@ -26,19 +26,19 @@
26
26
  "types": "./build/index.d.ts",
27
27
  "typeScriptVersion": "3.8.3",
28
28
  "dependencies": {
29
- "@wdio/config": "8.0.0-alpha.412+a2bc7ec67",
30
- "@wdio/globals": "8.0.0-alpha.412+a2bc7ec67",
31
- "@wdio/logger": "8.0.0-alpha.412+a2bc7ec67",
32
- "@wdio/types": "8.0.0-alpha.412+a2bc7ec67",
33
- "@wdio/utils": "8.0.0-alpha.412+a2bc7ec67",
29
+ "@wdio/config": "8.0.0-alpha.504+428a9d729",
30
+ "@wdio/globals": "8.0.0-alpha.504+428a9d729",
31
+ "@wdio/logger": "8.0.0-alpha.504+428a9d729",
32
+ "@wdio/types": "8.0.0-alpha.504+428a9d729",
33
+ "@wdio/utils": "8.0.0-alpha.504+428a9d729",
34
34
  "deepmerge": "^4.0.0",
35
35
  "expect-webdriverio": "^4.0.0-alpha.3",
36
36
  "gaze": "^1.1.2",
37
- "webdriver": "8.0.0-alpha.412+a2bc7ec67",
38
- "webdriverio": "8.0.0-alpha.412+a2bc7ec67"
37
+ "webdriver": "8.0.0-alpha.504+428a9d729",
38
+ "webdriverio": "8.0.0-alpha.504+428a9d729"
39
39
  },
40
40
  "publishConfig": {
41
41
  "access": "public"
42
42
  },
43
- "gitHead": "a2bc7ec67e2a5fe000e539f44b0ea97f6e08ccbd"
43
+ "gitHead": "428a9d729ae6231968a60908732fa3f607d195e9"
44
44
  }