@wdio/browser-runner 8.3.0 → 8.3.2

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
@@ -6,6 +6,7 @@ export default class BrowserRunner extends LocalRunner {
6
6
  #private;
7
7
  private options;
8
8
  protected _config: Options.Testrunner;
9
+ private _coverageMaps;
9
10
  constructor(options: BrowserRunnerOptionsImport, _config: Options.Testrunner);
10
11
  /**
11
12
  * nothing to initialise when running locally
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAQ5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAS1C,OAAO,KAAK,EAAE,oBAAoB,IAAI,0BAA0B,EAAmB,MAAM,YAAY,CAAA;AAGrG,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,WAAW;;IAO9C,OAAO,CAAC,OAAO;IACf,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU;gBAD7B,OAAO,EAAE,0BAA0B,EACjC,OAAO,EAAE,OAAO,CAAC,UAAU;IAczC;;OAEG;IACG,UAAU;IAoBhB,GAAG,CAAE,OAAO,EAAE,OAAO,GAAG,cAAc;IAmDtC;;;;OAIG;IACG,QAAQ;YAMA,wBAAwB;CAmEzC;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,WAAW,CAAC;QAClB,UAAU,oBAAqB,SAAQ,0BAA0B;SAAG;KACvE;CACJ"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAQ5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAS1C,OAAO,KAAK,EAAE,oBAAoB,IAAI,0BAA0B,EAAmB,MAAM,YAAY,CAAA;AAGrG,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,WAAW;;IAQ9C,OAAO,CAAC,OAAO;IACf,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU;IAJzC,OAAO,CAAC,aAAa,CAAoB;gBAG7B,OAAO,EAAE,0BAA0B,EACjC,OAAO,EAAE,OAAO,CAAC,UAAU;IAczC;;OAEG;IACG,UAAU;IAoBhB,GAAG,CAAE,OAAO,EAAE,OAAO,GAAG,cAAc;IA4DtC;;;;OAIG;IACG,QAAQ;YAMA,wBAAwB;CA2DzC;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,WAAW,CAAC;QAClB,UAAU,oBAAqB,SAAQ,0BAA0B;SAAG;KACvE;CACJ"}
package/build/index.js CHANGED
@@ -18,6 +18,7 @@ export default class BrowserRunner extends LocalRunner {
18
18
  #server;
19
19
  #coverageOptions;
20
20
  #reportsDirectory;
21
+ _coverageMaps = [];
21
22
  constructor(options, _config) {
22
23
  super(options, _config);
23
24
  this.options = options;
@@ -64,6 +65,7 @@ export default class BrowserRunner extends LocalRunner {
64
65
  }
65
66
  return worker.postMessage('workerHookExecution', payload);
66
67
  });
68
+ const mapStore = libSourceMap.createSourceMapStore();
67
69
  worker.on('message', async (payload) => {
68
70
  if (payload.name === 'sessionStarted' && !SESSIONS.has(payload.cid)) {
69
71
  SESSIONS.set(payload.cid, {
@@ -93,6 +95,10 @@ export default class BrowserRunner extends LocalRunner {
93
95
  if (payload.name === 'workerHookResult') {
94
96
  this.#server.resolveHook(payload.args);
95
97
  }
98
+ if (payload.name === 'coverageMap') {
99
+ const cmd = payload.content.coverageMap;
100
+ this._coverageMaps.push(await mapStore.transformCoverage(libCoverage.createCoverageMap(cmd)));
101
+ }
96
102
  });
97
103
  return worker;
98
104
  }
@@ -107,22 +113,14 @@ export default class BrowserRunner extends LocalRunner {
107
113
  return this._generateCoverageReports();
108
114
  }
109
115
  async _generateCoverageReports() {
110
- if (!this.#coverageOptions.enabled) {
111
- return true;
112
- }
113
- /**
114
- * skip if no coverage directory was created
115
- */
116
- const reportsDirectoryExist = await fs.access(this.#reportsDirectory)
117
- .then(() => true, () => false);
118
- if (!reportsDirectoryExist) {
116
+ if (!this.#coverageOptions.enabled || this._coverageMaps.length === 0) {
119
117
  return true;
120
118
  }
119
+ const firstCoverageMapEntry = this._coverageMaps.shift();
120
+ const coverageMap = libCoverage.createCoverageMap(firstCoverageMapEntry);
121
+ this._coverageMaps.forEach((cm) => coverageMap.merge(cm));
121
122
  const coverageIssues = [];
122
123
  try {
123
- const globalCoverageVar = JSON.parse((await fs.readFile(path.join(this.#reportsDirectory, 'out.json'))).toString());
124
- const mapStore = libSourceMap.createSourceMapStore();
125
- const coverageMap = await mapStore.transformCoverage(libCoverage.createCoverageMap(globalCoverageVar));
126
124
  const context = libReport.createContext({
127
125
  dir: this.#reportsDirectory,
128
126
  defaultSummarizer: 'nested',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/browser-runner",
3
- "version": "8.3.0",
3
+ "version": "8.3.2",
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",
@@ -31,8 +31,8 @@
31
31
  "@originjs/vite-plugin-commonjs": "^1.0.3",
32
32
  "@types/istanbul-lib-source-maps": "^4.0.1",
33
33
  "@types/node": "^18.11.18",
34
- "@wdio/globals": "8.3.0",
35
- "@wdio/local-runner": "8.3.0",
34
+ "@wdio/globals": "8.3.2",
35
+ "@wdio/local-runner": "8.3.2",
36
36
  "@wdio/logger": "8.1.0",
37
37
  "@wdio/mocha-framework": "8.3.0",
38
38
  "@wdio/protocols": "8.2.0",
@@ -51,8 +51,8 @@
51
51
  "vite": "^4.0.4",
52
52
  "vite-plugin-istanbul": "^4.0.0",
53
53
  "vite-plugin-top-level-await": "^1.2.2",
54
- "webdriver": "8.3.0",
55
- "webdriverio": "8.3.0",
54
+ "webdriver": "8.3.2",
55
+ "webdriverio": "8.3.2",
56
56
  "ws": "^8.12.0"
57
57
  },
58
58
  "scripts": {
@@ -63,7 +63,7 @@
63
63
  },
64
64
  "devDependencies": {
65
65
  "@types/ws": "^8.5.4",
66
- "@wdio/runner": "8.3.0"
66
+ "@wdio/runner": "8.3.2"
67
67
  },
68
- "gitHead": "156a246e8117463cf3c762d2da5bf9eef3a476ea"
68
+ "gitHead": "5bf1ad9398ce6a4cc810b331944612d105cdc92e"
69
69
  }