@wdio/browser-runner 8.29.5 → 8.29.6

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,12 +1,5 @@
1
+ import type { StencilEnvironment } from '../../../stencil/index.d.ts';
1
2
  import type { NewSpecPageOptions } from '@stencil/core/internal';
2
- interface StencilEnvironment {
3
- /**
4
- * After changes have been made to a component, such as a update to a property or
5
- * attribute, the test page does not automatically apply the changes. In order to
6
- * wait for, and apply the update, call await `flushAll()`.
7
- */
8
- flushAll: () => void;
9
- }
10
3
  /**
11
4
  * Creates a new spec page for unit testing
12
5
  * @param opts the options to apply to the spec page that influence its configuration and operation
@@ -67,5 +60,4 @@ export declare const enum CMP_FLAGS {
67
60
  * @returns a compact format for component metadata, intended for runtime use
68
61
  */
69
62
  export declare const formatComponentRuntimeMeta: (compilerMeta: any, includeMethods: boolean) => any;
70
- export {};
71
63
  //# sourceMappingURL=stencil.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stencil.d.ts","sourceRoot":"","sources":["../../../src/browser/fixtures/stencil.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAKR,kBAAkB,EACrB,MAAM,wBAAwB,CAAA;AAe/B,UAAU,kBAAkB;IACxB;;;;OAIG;IACH,QAAQ,EAAE,MAAM,IAAI,CAAA;CACvB;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,kBAAkB,GAAG,kBAAkB,CA4HnE;AAsGD;;;;;GAKG;AACH,0BAAkB,SAAS;IACvB;;;OAGG;IACH,sBAAsB,IAAS;IAC/B;;;OAGG;IACH,sBAAsB,IAAS;IAC/B;;OAEG;IACH,iBAAiB,IAAS;IAM1B;;;;;OAKG;IACH,kBAAkB,IAAS;IAC3B;;;OAGG;IACH,oBAAoB,KAAS;IAC7B;;OAEG;IACH,OAAO,KAAS;IAEhB;;;;;OAKG;IACH,wBAAwB,KAA8C;CACzE;AASD;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,iBACrB,GAAG,kBACD,OAAO,KACxB,GAyBF,CAAA"}
1
+ {"version":3,"file":"stencil.d.ts","sourceRoot":"","sources":["../../../src/browser/fixtures/stencil.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAgBrE,OAAO,KAAK,EAKR,kBAAkB,EACrB,MAAM,wBAAwB,CAAA;AAe/B;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,kBAAkB,GAAG,kBAAkB,CA2HnE;AAsGD;;;;;GAKG;AACH,0BAAkB,SAAS;IACvB;;;OAGG;IACH,sBAAsB,IAAS;IAC/B;;;OAGG;IACH,sBAAsB,IAAS;IAC/B;;OAEG;IACH,iBAAiB,IAAS;IAM1B;;;;;OAKG;IACH,kBAAkB,IAAS;IAC3B;;;OAGG;IACH,oBAAoB,KAAS;IAC7B;;OAEG;IACH,OAAO,KAAS;IAEhB;;;;;OAKG;IACH,wBAAwB,KAA8C;CACzE;AASD;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,iBACrB,GAAG,kBACD,OAAO,KACxB,GAyBF,CAAA"}
@@ -4,9 +4,12 @@ import { h } from '@stencil/core';
4
4
  * This is used by Stencil.js internally.
5
5
  */
6
6
  process.nextTick = (cb) => setTimeout(cb, 0);
7
+ /**
8
+ * in case the user has his tsconfig.json configured to expect "jsx" to be "react"
9
+ */
7
10
  // @ts-expect-error
8
11
  window.React = {
9
- createElement: h,
12
+ createElement: h
10
13
  };
11
14
  import { bootstrapLazy, flushAll, insertVdomAnnotations, registerComponents, registerModule, renderVdom, setSupportsShadowDom, startAutoApplyChanges, styles, writeTask,
12
15
  // @ts-expect-error
@@ -71,16 +74,19 @@ export function render(opts) {
71
74
  }
72
75
  registerModule(bundleId, Cstr);
73
76
  /**
74
- * Register the component as a custom element
77
+ * Register the component as a custom element only if not already registered
75
78
  */
76
- customElements.define(Cstr.COMPILER_META.tagName, Cstr);
79
+ if (!customElements.get(Cstr.COMPILER_META.tagName)) {
80
+ customElements.define(Cstr.COMPILER_META.tagName, Cstr);
81
+ }
77
82
  const lazyBundleRuntimeMeta = formatLazyBundleRuntimeMeta(bundleId, [Cstr.COMPILER_META]);
78
83
  return lazyBundleRuntimeMeta;
79
84
  });
80
85
  const page = {
81
86
  container,
82
87
  styles,
83
- flushAll
88
+ flushAll,
89
+ unmount: () => container.remove()
84
90
  };
85
91
  if (typeof opts.direction === 'string') {
86
92
  document.documentElement.setAttribute('dir', opts.direction);
@@ -99,7 +105,7 @@ export function render(opts) {
99
105
  $flags$: 0,
100
106
  $modeName$: undefined,
101
107
  $cmpMeta$: cmpMeta,
102
- $hostElement$: document.body,
108
+ $hostElement$: container,
103
109
  };
104
110
  renderVdom(ref, opts.template());
105
111
  }
@@ -107,16 +113,12 @@ export function render(opts) {
107
113
  Object.defineProperty(page, 'root', {
108
114
  get() {
109
115
  if (!rootComponent) {
110
- rootComponent = findRootComponent(cmpTags, document.body);
116
+ rootComponent = findRootComponent(cmpTags, container);
111
117
  }
112
118
  if (rootComponent) {
113
119
  return rootComponent;
114
120
  }
115
- const firstElementChild = document.body.firstElementChild;
116
- if (!firstElementChild) {
117
- return firstElementChild;
118
- }
119
- return null;
121
+ return container.firstElementChild;
120
122
  },
121
123
  });
122
124
  if (opts.hydrateServerSide) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/browser-runner",
3
- "version": "8.29.5",
3
+ "version": "8.29.6",
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",
@@ -71,5 +71,5 @@
71
71
  "publishConfig": {
72
72
  "access": "public"
73
73
  },
74
- "gitHead": "35c91fce089a8aff2dc3ec1407d6b91bc5cf0c76"
74
+ "gitHead": "45ff936ee5c76137bf96c15a2fc36c362a0ff693"
75
75
  }
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * Options pertaining to the creation and functionality of a {@link SpecPage}
4
4
  */
5
- interface RenderOptions {
5
+ export interface RenderOptions {
6
6
  /**
7
7
  * An array of components to test. Component classes can be imported into the spec file, then their reference should be added to the `component` array in order to be used throughout the test.
8
8
  */
@@ -58,7 +58,7 @@ interface RenderOptions {
58
58
  strictBuild?: boolean;
59
59
  }
60
60
 
61
- interface StencilEnvironment {
61
+ export interface StencilEnvironment {
62
62
  /**
63
63
  * After changes have been made to a component, such as a update to a property or
64
64
  * attribute, the test page does not automatically apply the changes. In order to
@@ -70,13 +70,17 @@ interface StencilEnvironment {
70
70
  */
71
71
  styles: Record<string, string>
72
72
  /**
73
- * Container element in which the template is being rendered.
73
+ * Container element in which the template is being rendered into.
74
74
  */
75
75
  container: HTMLElement
76
76
  /**
77
77
  * The root component of the template.
78
78
  */
79
79
  root: HTMLElement
80
+ /**
81
+ * Removes the container element from the DOM.
82
+ */
83
+ unmount: () => void
80
84
  }
81
85
 
82
86
  export function render(opts: RenderOptions): StencilEnvironment