@testomatio/reporter 1.6.12 → 1.6.14

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.
@@ -116,9 +116,13 @@ class PlaywrightReporter {
116
116
  }
117
117
 
118
118
  if (artifact.body) {
119
- const fileName = tmpFile();
120
- fs.writeFileSync(fileName, artifact.body);
121
- return fileName;
119
+ let filePath = generateTmpFilepath(artifact.name);
120
+
121
+ const extension = artifact.contentType?.split('/')[1]?.replace('jpeg', 'jpg');
122
+ if (extension) filePath += `.${extension}`;
123
+
124
+ fs.writeFileSync(filePath, artifact.body);
125
+ return filePath;
122
126
  }
123
127
 
124
128
  return null;
@@ -218,9 +222,10 @@ function appendStep(step, shift = 0) {
218
222
  return resultStep;
219
223
  }
220
224
 
221
- function tmpFile(prefix = 'tmp.') {
225
+ function generateTmpFilepath(filename = '') {
226
+ filename = filename || `tmp.${crypto.randomBytes(16).toString('hex')}`;
222
227
  const tmpdir = os.tmpdir();
223
- return path.join(tmpdir, prefix + crypto.randomBytes(16).toString('hex'));
228
+ return path.join(tmpdir, filename);
224
229
  }
225
230
 
226
231
  /**
package/lib/client.js CHANGED
@@ -65,7 +65,7 @@ class Client {
65
65
  try {
66
66
  const filterPipe = this.pipes.find(p => p.constructor.name.toLowerCase() === `${pipe.toLowerCase()}pipe`);
67
67
 
68
- if (!filterPipe.isEnabled) {
68
+ if (!filterPipe?.isEnabled) {
69
69
  // TODO:for the future for the another pipes
70
70
  console.warn(
71
71
  APP_PREFIX,
package/lib/pipe/html.js CHANGED
@@ -60,6 +60,8 @@ class HtmlPipe {
60
60
  // empty
61
61
  }
62
62
 
63
+ async prepareRun() {}
64
+
63
65
  updateRun() {
64
66
  // empty
65
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "1.6.12",
3
+ "version": "1.6.14",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "typings": "typings/index.d.ts",