@testomatio/reporter 2.0.1-beta.7 → 2.0.1-beta.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.
@@ -123,18 +123,9 @@ class PlaywrightReporter {
123
123
  }
124
124
  if (artifact.body) {
125
125
  let filePath = generateTmpFilepath(artifact.name);
126
- // Check if file already has an extension
127
- const hasExtension = artifact.name && path_1.default.extname(artifact.name);
128
- if (!hasExtension && artifact.contentType) {
129
- const mimeType = artifact.contentType.split('/')[1];
130
- const extensionMap = {
131
- jpeg: 'jpg',
132
- plain: 'txt',
133
- };
134
- const extension = extensionMap[mimeType] || mimeType;
135
- if (extension)
136
- filePath += `.${extension}`;
137
- }
126
+ const extension = artifact.contentType?.split('/')[1]?.replace('jpeg', 'jpg');
127
+ if (extension)
128
+ filePath += `.${extension}`;
138
129
  fs_1.default.writeFileSync(filePath, artifact.body);
139
130
  return filePath;
140
131
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "2.0.1-beta.7",
3
+ "version": "2.0.1-beta.8",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "engines": {
6
6
  "node": ">=18"
@@ -125,24 +125,20 @@ class PlaywrightReporter {
125
125
  #getArtifactPath(artifact) {
126
126
  if (artifact.path) {
127
127
  if (path.isAbsolute(artifact.path)) return artifact.path;
128
+
128
129
  return path.join(this.config.outputDir || this.config.projects[0].outputDir, artifact.path);
129
130
  }
131
+
130
132
  if (artifact.body) {
131
133
  let filePath = generateTmpFilepath(artifact.name);
132
- // Check if file already has an extension
133
- const hasExtension = artifact.name && path.extname(artifact.name);
134
- if (!hasExtension && artifact.contentType) {
135
- const mimeType = artifact.contentType.split('/')[1];
136
- const extensionMap = {
137
- jpeg: 'jpg',
138
- plain: 'txt',
139
- };
140
- const extension = extensionMap[mimeType] || mimeType;
141
- if (extension) filePath += `.${extension}`;
142
- }
134
+
135
+ const extension = artifact.contentType?.split('/')[1]?.replace('jpeg', 'jpg');
136
+ if (extension) filePath += `.${extension}`;
137
+
143
138
  fs.writeFileSync(filePath, artifact.body);
144
139
  return filePath;
145
140
  }
141
+
146
142
  return null;
147
143
  }
148
144