@allurereport/plugin-csv 3.0.0 → 3.1.0
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/dist/plugin.js +9 -2
- package/package.json +3 -3
package/dist/plugin.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { formatDuration } from "@allurereport/core-api";
|
|
2
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
3
|
+
import { dirname, isAbsolute } from "node:path";
|
|
2
4
|
import { generateCsv } from "./csv.js";
|
|
3
5
|
import { formatSteps, labelValue } from "./utils.js";
|
|
4
6
|
const defaultFields = [
|
|
@@ -32,10 +34,15 @@ export class CsvPlugin {
|
|
|
32
34
|
this.done = async (context, store) => {
|
|
33
35
|
const { reportFiles } = context;
|
|
34
36
|
const testResults = await store.allTestResults();
|
|
35
|
-
const { fields = defaultFields, sort = defaultSort, filter, fileName = "report.csv" } = this.options;
|
|
37
|
+
const { fields = defaultFields, sort = defaultSort, filter, fileName = "allure-report.csv" } = this.options;
|
|
36
38
|
const content = await generateCsv(testResults, fields, sort, filter, this.options);
|
|
37
39
|
const result = Buffer.from(content, "utf-8");
|
|
38
|
-
|
|
40
|
+
if (!isAbsolute(fileName)) {
|
|
41
|
+
await reportFiles.addFile(fileName, result);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
await mkdir(dirname(fileName), { recursive: true });
|
|
45
|
+
await writeFile(fileName, result);
|
|
39
46
|
};
|
|
40
47
|
}
|
|
41
48
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/plugin-csv",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Allure CSV report",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"test": "rimraf ./out && vitest run"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@allurereport/core-api": "3.
|
|
34
|
-
"@allurereport/plugin-api": "3.
|
|
33
|
+
"@allurereport/core-api": "3.1.0",
|
|
34
|
+
"@allurereport/plugin-api": "3.1.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@stylistic/eslint-plugin": "^2.6.1",
|