@as-pect/csv-reporter 7.0.0 → 8.0.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@as-pect/csv-reporter",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "csv reporter for as-pect",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"author": "Joshua Tenner",
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"csv-stringify": "^6.2.
|
|
19
|
+
"csv-stringify": "^6.2.1"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@as-pect/core": "^
|
|
22
|
+
"@as-pect/core": "^8.0.0"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
declare module "index" {
|
|
3
|
-
import { Stringifier } from "csv-stringify";
|
|
4
|
-
import { WriteStream } from "fs";
|
|
5
|
-
import { TestContext, IReporter, TestNode } from "@as-pect/core";
|
|
6
|
-
/**
|
|
7
|
-
* This class is responsible for creating a csv file located at {testName}.spec.csv. It will
|
|
8
|
-
* contain a set of tests with relevant pass and fail information.
|
|
9
|
-
*/
|
|
10
|
-
export default class CSVReporter implements IReporter {
|
|
11
|
-
protected output: Stringifier | null;
|
|
12
|
-
protected fileName: WriteStream | null;
|
|
13
|
-
onEnter(ctx: TestContext): void;
|
|
14
|
-
onExit(_ctx: TestContext, node: TestNode): void;
|
|
15
|
-
onFinish(): void;
|
|
16
|
-
protected onGroupFinish(group: TestNode): void;
|
|
17
|
-
protected onTestFinish(group: TestNode, test: TestNode): void;
|
|
18
|
-
protected onTodo(group: TestNode, desc: string): void;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=as-pect.csv-reporter.amd.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"as-pect.csv-reporter.amd.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;IAAA,OAAO,EAAE,WAAW,EAAa,MAAM,eAAe,CAAC;IACvD,OAAO,EAAE,WAAW,EAAqB,MAAM,IAAI,CAAC;IAEpD,OAAO,EAAgB,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;IAiB/E;;;OAGG;IACH,MAAM,CAAC,OAAO,OAAO,WAAY,YAAW,SAAS;QACnD,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAQ;QAC5C,SAAS,CAAC,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAQ;QAEvC,OAAO,CAAC,KAAK,WAAW,GAAG,IAAI;QAW/B,MAAM,CAAC,MAAM,WAAW,EAAE,MAAM,QAAQ,GAAG,IAAI;QAM/C,QAAQ,IAAI,IAAI;QAIvB,SAAS,CAAC,aAAa,CAAC,OAAO,QAAQ,GAAG,IAAI;QAO9C,SAAS,CAAC,YAAY,CAAC,OAAO,QAAQ,EAAE,MAAM,QAAQ;QAkBtD,SAAS,CAAC,MAAM,CAAC,OAAO,QAAQ,EAAE,MAAM,MAAM;KAG/C"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
define("index", ["require", "exports", "csv-stringify", "fs", "path"], function (require, exports, csv_stringify_1, fs_1, path_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
/**
|
|
5
|
-
* This is a list of all the columns in the exported csv file.
|
|
6
|
-
*/
|
|
7
|
-
const csvColumns = [
|
|
8
|
-
"Group",
|
|
9
|
-
"Name",
|
|
10
|
-
"Ran",
|
|
11
|
-
"Negated",
|
|
12
|
-
"Pass",
|
|
13
|
-
"Runtime",
|
|
14
|
-
"Message",
|
|
15
|
-
"Actual",
|
|
16
|
-
"Expected",
|
|
17
|
-
];
|
|
18
|
-
/**
|
|
19
|
-
* This class is responsible for creating a csv file located at {testName}.spec.csv. It will
|
|
20
|
-
* contain a set of tests with relevant pass and fail information.
|
|
21
|
-
*/
|
|
22
|
-
class CSVReporter {
|
|
23
|
-
output = null;
|
|
24
|
-
fileName = null;
|
|
25
|
-
onEnter(ctx) {
|
|
26
|
-
this.output = (0, csv_stringify_1.stringify)({ columns: csvColumns });
|
|
27
|
-
const extension = (0, path_1.extname)(ctx.fileName);
|
|
28
|
-
const dir = (0, path_1.dirname)(ctx.fileName);
|
|
29
|
-
const base = (0, path_1.basename)(ctx.fileName, extension);
|
|
30
|
-
const outPath = (0, path_1.join)(process.cwd(), dir, base + ".csv");
|
|
31
|
-
this.fileName = (0, fs_1.createWriteStream)(outPath, "utf8");
|
|
32
|
-
this.output.pipe(this.fileName);
|
|
33
|
-
this.output.write(csvColumns);
|
|
34
|
-
}
|
|
35
|
-
onExit(_ctx, node) {
|
|
36
|
-
if (node.type === 1 /* TestNodeType.Group */) {
|
|
37
|
-
this.onGroupFinish(node);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
onFinish() {
|
|
41
|
-
this.output.end();
|
|
42
|
-
}
|
|
43
|
-
onGroupFinish(group) {
|
|
44
|
-
if (group.children.length === 0)
|
|
45
|
-
return;
|
|
46
|
-
group.groupTests.forEach((test) => this.onTestFinish(group, test));
|
|
47
|
-
group.groupTodos.forEach((desc) => this.onTodo(group, desc));
|
|
48
|
-
}
|
|
49
|
-
onTestFinish(group, test) {
|
|
50
|
-
this.output.write([
|
|
51
|
-
group.name,
|
|
52
|
-
test.ran ? "RAN" : "NOT RUN",
|
|
53
|
-
test.name,
|
|
54
|
-
test.negated ? "TRUE" : "FALSE",
|
|
55
|
-
test.pass ? "PASS" : "FAIL",
|
|
56
|
-
test.deltaT.toString(),
|
|
57
|
-
test.message,
|
|
58
|
-
test.actual ? test.actual.stringify({ indent: 0 }) : "",
|
|
59
|
-
test.expected
|
|
60
|
-
? `${test.negated ? "Not " : ""}${test.expected.stringify({
|
|
61
|
-
indent: 0,
|
|
62
|
-
})}`
|
|
63
|
-
: "",
|
|
64
|
-
]);
|
|
65
|
-
}
|
|
66
|
-
onTodo(group, desc) {
|
|
67
|
-
this.output.write([group.name, "TODO", desc, "", "", "", "", "", ""]);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
exports.default = CSVReporter;
|
|
71
|
-
;
|
|
72
|
-
});
|
|
73
|
-
//# sourceMappingURL=as-pect.csv-reporter.amd.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"as-pect.csv-reporter.amd.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;IAKA;;OAEG;IACH,MAAM,UAAU,GAAG;QACjB,OAAO;QACP,MAAM;QACN,KAAK;QACL,SAAS;QACT,MAAM;QACN,SAAS;QACT,SAAS;QACT,QAAQ;QACR,UAAU;KACX,CAAC;IAEF;;;OAGG;IACH,MAAqB,WAAW;QACpB,MAAM,GAAuB,IAAI,CAAC;QAClC,QAAQ,GAAuB,IAAI,CAAC;QAEvC,OAAO,CAAC,GAAgB;YAC7B,IAAI,CAAC,MAAM,GAAG,IAAA,yBAAS,EAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC;YACjD,MAAM,SAAS,GAAG,IAAA,cAAO,EAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACxC,MAAM,GAAG,GAAG,IAAA,cAAO,EAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAClC,MAAM,IAAI,GAAG,IAAA,eAAQ,EAAC,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;YAC/C,MAAM,OAAO,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,IAAI,GAAG,MAAM,CAAC,CAAC;YACxD,IAAI,CAAC,QAAQ,G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