wdio-test-ledger-service 9.2.6 → 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 +25 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wdio-test-ledger-service",
3
- "version": "9.2.6",
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
@@ -46,7 +46,15 @@ class TestLedgerLauncher {
46
46
  }
47
47
 
48
48
  async onComplete(exit_code, config) {
49
- const data = this.buildData(config);
49
+ let data = null;
50
+ try {
51
+ data = this.buildData(config);
52
+ }
53
+ catch(e) {
54
+ fs.writeFileSync(`${this.options.reporterOutputDir}/trio-builddata-error.txt`, e.message, { encoding : `utf-8` });
55
+ return;
56
+ }
57
+
50
58
 
51
59
  try {
52
60
  const response = await this.post(data);
@@ -111,14 +119,26 @@ class TestLedgerLauncher {
111
119
  fs.writeFileSync(`${this.options.reporterOutputDir}/trio-readfile-error.txt`, e.message, { encoding : `utf-8` });
112
120
  }
113
121
 
114
- 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];
115
127
 
116
128
  if(!tmp) {
117
129
  continue;
118
130
  }
119
131
 
120
- const content = JSON.parse(tmp);
121
- 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');
122
142
 
123
143
  if(content.passed && Number(process.env.SKIP_PASSED_UPLOADS) === 1) {
124
144
  continue;
@@ -140,7 +160,7 @@ class TestLedgerLauncher {
140
160
 
141
161
  for(const test of content.tests) {
142
162
  const hook = test.type === `hook`;
143
- 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');
144
164
 
145
165
  if(!all_errors[test_key]) {
146
166
  all_errors[test_key] = [];