@wdio/browser-runner 8.28.8 → 8.29.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"expect.d.ts","sourceRoot":"","sources":["../../src/browser/expect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA2E,MAAM,QAAQ,CAAA;AA2HxG,OAAO,EAAE,MAAM,EAAE,CAAA"}
1
+ {"version":3,"file":"expect.d.ts","sourceRoot":"","sources":["../../src/browser/expect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA2E,MAAM,QAAQ,CAAA;AA2JxG,OAAO,EAAE,MAAM,EAAE,CAAA"}
@@ -58,6 +58,16 @@ expect.extend(matchers.reduce((acc, matcherName) => {
58
58
  if (context instanceof Element) {
59
59
  expectRequest.element = await $(context);
60
60
  }
61
+ else if (typeof context === 'object' && !('sessionId' in context)) {
62
+ /**
63
+ * check if context is an object or promise and resolve it
64
+ * but not pass through the browser object
65
+ */
66
+ expectRequest.context = context;
67
+ if ('then' in context) {
68
+ expectRequest.context = await context;
69
+ }
70
+ }
61
71
  /**
62
72
  * Avoid serialization issues when sending over the element. If we create
63
73
  * an element from an existing HTMLElement, it might have custom properties
@@ -66,6 +76,26 @@ expect.extend(matchers.reduce((acc, matcherName) => {
66
76
  if (expectRequest.element && typeof expectRequest.element.selector !== 'string') {
67
77
  expectRequest.element.selector = undefined;
68
78
  }
79
+ /**
80
+ * pass along the stack trace from the browser to the testrunner so that
81
+ * the snapshot tool can determine the correct location to update the
82
+ * snapshot call.
83
+ */
84
+ if (matcherName === 'toMatchInlineSnapshot') {
85
+ expectRequest.scope.errorStack = (new Error('inline snapshot error'))
86
+ .stack
87
+ ?.split('\n')
88
+ .find((line) => line.includes(window.__wdioSpec__))
89
+ /**
90
+ * stack traces within the browser have an url path, e.g.
91
+ * `http://localhost:8080/@fs/path/to/__tests__/unit/snapshot.test.js:123:45`
92
+ * that we want to remove so that the stack trace is properly
93
+ * parsed by Vitest, e.g. make it to:
94
+ * `/__tests__/unit/snapshot.test.js:123:45`
95
+ */
96
+ ?.replace(/http:\/\/localhost:\d+/g, '')
97
+ .replace('/@fs/', '/');
98
+ }
69
99
  import.meta.hot.send(WDIO_EVENT_NAME, { type: MESSAGE_TYPES.expectRequestMessage, value: expectRequest });
70
100
  const contextString = 'elementId' in context ? 'WebdriverIO.Element' : 'WebdriverIO.Browser';
71
101
  return new Promise((resolve, reject) => {
@@ -1 +1 @@
1
- {"version":3,"file":"mocha.d.ts","sourceRoot":"","sources":["../../../src/browser/frameworks/mocha.ts"],"names":[],"mappings":"AA6BA,qBAAa,cAAe,SAAQ,WAAW;;;IAyB3C,MAAM,KAAK,kBAAkB,aAE5B;IAED,IAAI,IAAI,WAEP;IAED,iBAAiB;IAWjB,wBAAwB,CAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO;IAatE,GAAG;CAwIZ"}
1
+ {"version":3,"file":"mocha.d.ts","sourceRoot":"","sources":["../../../src/browser/frameworks/mocha.ts"],"names":[],"mappings":"AA6BA,qBAAa,cAAe,SAAQ,WAAW;;;IAyB3C,MAAM,KAAK,kBAAkB,aAE5B;IAED,IAAI,IAAI,WAEP;IAED,iBAAiB;IAWjB,wBAAwB,CAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO;IAatE,GAAG;CA+IZ"}
@@ -81,6 +81,15 @@ export class MochaFramework extends HTMLElement {
81
81
  globalTeardownScripts.push(mochaGlobalTeardown);
82
82
  }
83
83
  }
84
+ const cid = getCID();
85
+ if (!cid) {
86
+ throw new Error('"cid" query parameter is missing');
87
+ }
88
+ const beforeHook = this.#getHook('beforeHook');
89
+ const beforeTest = this.#getHook('beforeTest');
90
+ const afterHook = this.#getHook('afterHook');
91
+ const afterTest = this.#getHook('afterTest');
92
+ setupEnv(cid, window.__wdioEnv__.args, beforeTest, beforeHook, afterTest, afterHook);
84
93
  /**
85
94
  * import test case (order is important here)
86
95
  */
@@ -96,15 +105,6 @@ export class MochaFramework extends HTMLElement {
96
105
  * listen on socket events from testrunner
97
106
  */
98
107
  import.meta.hot?.on(WDIO_EVENT_NAME, this.#handleSocketMessage.bind(this));
99
- const cid = getCID();
100
- if (!cid) {
101
- throw new Error('"cid" query parameter is missing');
102
- }
103
- const beforeHook = this.#getHook('beforeHook');
104
- const beforeTest = this.#getHook('beforeTest');
105
- const afterHook = this.#getHook('afterHook');
106
- const afterTest = this.#getHook('afterTest');
107
- setupEnv(cid, window.__wdioEnv__.args, beforeTest, beforeHook, afterTest, afterHook);
108
108
  const self = this;
109
109
  const mochaBeforeHook = globalThis.before || globalThis.suiteSetup;
110
110
  mochaBeforeHook(async function () {
@@ -172,6 +172,13 @@ export class MochaFramework extends HTMLElement {
172
172
  return reject(new Error('"cid" query parameter is missing'));
173
173
  }
174
174
  this.#hookResolver.set(id, { resolve, reject });
175
+ args = args.map((arg) => {
176
+ if (typeof arg === 'object') {
177
+ const { type, title, body, async, sync, timedOut, pending, parent } = arg;
178
+ return { type, title, body, async, sync, timedOut, pending, parent, file: this.#spec };
179
+ }
180
+ return arg;
181
+ });
175
182
  import.meta.hot?.send(WDIO_EVENT_NAME, this.#hookTrigger({ name, id, cid, args }));
176
183
  });
177
184
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/browser-runner",
3
- "version": "8.28.8",
3
+ "version": "8.29.0",
4
4
  "description": "A WebdriverIO runner to run unit tests tests in the browser.",
5
5
  "author": "Christian Bromann <mail@bromann.dev>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-browser-runner",
@@ -34,17 +34,17 @@
34
34
  "@originjs/vite-plugin-commonjs": "^1.0.3",
35
35
  "@types/istanbul-lib-source-maps": "^4.0.1",
36
36
  "@vitest/spy": "^1.0.1",
37
- "@wdio/globals": "8.28.8",
38
- "@wdio/local-runner": "8.28.8",
37
+ "@wdio/globals": "8.29.0",
38
+ "@wdio/local-runner": "8.29.0",
39
39
  "@wdio/logger": "8.28.0",
40
- "@wdio/mocha-framework": "8.28.8",
40
+ "@wdio/mocha-framework": "8.29.0",
41
41
  "@wdio/protocols": "^8.24.12",
42
- "@wdio/runner": "8.28.8",
43
- "@wdio/types": "8.28.6",
44
- "@wdio/utils": "8.28.8",
42
+ "@wdio/runner": "8.29.0",
43
+ "@wdio/types": "8.29.0",
44
+ "@wdio/utils": "8.29.0",
45
45
  "deepmerge-ts": "^5.0.0",
46
46
  "expect": "^29.7.0",
47
- "expect-webdriverio": "^4.8.1",
47
+ "expect-webdriverio": "^4.9.3",
48
48
  "get-port": "^7.0.0",
49
49
  "import-meta-resolve": "^4.0.0",
50
50
  "istanbul-lib-coverage": "^3.2.0",
@@ -59,8 +59,8 @@
59
59
  "vite": "~4.5.0",
60
60
  "vite-plugin-istanbul": "^5.0.0",
61
61
  "vite-plugin-top-level-await": "^1.3.0",
62
- "webdriver": "8.28.8",
63
- "webdriverio": "8.28.8"
62
+ "webdriver": "8.29.0",
63
+ "webdriverio": "8.29.0"
64
64
  },
65
65
  "scripts": {
66
66
  "prepare": "rimraf node_modules/@wdio/config node_modules/@wdio/repl node_modules/@wdio/utils"
@@ -68,5 +68,5 @@
68
68
  "publishConfig": {
69
69
  "access": "public"
70
70
  },
71
- "gitHead": "3ce19a7ceca0a038e9b1ec66f8774bbcb0e8098b"
71
+ "gitHead": "cfd2ee1a1b4c4dc5b399ada6c28e8ccfa90c3bf1"
72
72
  }