wdio-test-ledger-service 9.2.7 → 9.2.8

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +16 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wdio-test-ledger-service",
3
- "version": "9.2.7",
3
+ "version": "9.2.8",
4
4
  "description": "WebdriverIO server to send reporter data to testledger.dev",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/index.js CHANGED
@@ -119,14 +119,26 @@ class TestLedgerLauncher {
119
119
  fs.writeFileSync(`${this.options.reporterOutputDir}/trio-readfile-error.txt`, e.message, { encoding : `utf-8` });
120
120
  }
121
121
 
122
- const identifier = file.match(/wdio-(\d+-\d+)-/)[1];
122
+ const match = file.match(/wdio-(\d+-\d+)-/);
123
+ if(!match) {
124
+ continue;
125
+ }
126
+ const identifier = match[1];
123
127
 
124
128
  if(!tmp) {
125
129
  continue;
126
130
  }
127
131
 
128
- const content = JSON.parse(tmp);
129
- const suite_key = btoa(`${identifier}:${content.spec_file}:${content.capabilities}:${content.title}`);
132
+ let content;
133
+ try {
134
+ content = JSON.parse(tmp);
135
+ }
136
+ catch(e) {
137
+ fs.writeFileSync(`${this.options.reporterOutputDir}/trio-json-parse-error.txt`, `Failed to parse ${file}: ${e.message}`, { encoding : `utf-8` });
138
+ continue;
139
+ }
140
+
141
+ const suite_key = Buffer.from(`${identifier}:${content.spec_file}:${content.capabilities}:${content.title}`).toString('base64');
130
142
 
131
143
  if(content.passed && Number(process.env.SKIP_PASSED_UPLOADS) === 1) {
132
144
  continue;
@@ -148,7 +160,7 @@ class TestLedgerLauncher {
148
160
 
149
161
  for(const test of content.tests) {
150
162
  const hook = test.type === `hook`;
151
- const test_key = btoa(`${identifier}:${content.spec_file}:${content.capabilities}:${content.title}:${test.title}`);
163
+ const test_key = Buffer.from(`${identifier}:${content.spec_file}:${content.capabilities}:${content.title}:${test.title}`).toString('base64');
152
164
 
153
165
  if(!all_errors[test_key]) {
154
166
  all_errors[test_key] = [];