@as-pect/json-reporter 7.0.1 → 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/json-reporter",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "Json reporter for as-pect",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.ts",
|
|
@@ -16,6 +16,6 @@
|
|
|
16
16
|
"author": "Joshua Tenner",
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@as-pect/core": "^
|
|
19
|
+
"@as-pect/core": "^8.0.0"
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
declare module "index" {
|
|
3
|
-
import { WriteStream } from "fs";
|
|
4
|
-
import { TestContext, IReporter, TestNode } from "@as-pect/core";
|
|
5
|
-
/**
|
|
6
|
-
* This class reports all relevant test statistics to a JSON file located at
|
|
7
|
-
* `{testLocation}.spec.json`.
|
|
8
|
-
*/
|
|
9
|
-
export default class JSONReporter implements IReporter {
|
|
10
|
-
protected file: WriteStream | null;
|
|
11
|
-
private first;
|
|
12
|
-
onEnter(ctx: TestContext): void;
|
|
13
|
-
onExit(_ctx: TestContext, node: TestNode): void;
|
|
14
|
-
onFinish(_ctx: TestContext): void;
|
|
15
|
-
protected onGroupFinish(group: TestNode): void;
|
|
16
|
-
protected onTestFinish(group: TestNode, test: TestNode): void;
|
|
17
|
-
protected onTodo(group: TestNode, desc: string): void;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=as-pect.json-reporter.amd.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"as-pect.json-reporter.amd.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;IAAA,OAAO,EAAE,WAAW,EAAqB,MAAM,IAAI,CAAC;IAEpD,OAAO,EAAgB,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;IAE/E;;;OAGG;IACH,MAAM,CAAC,OAAO,OAAO,YAAa,YAAW,SAAS;QACpD,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAQ;QAE1C,OAAO,CAAC,KAAK,CAAiB;QAEvB,OAAO,CAAC,KAAK,WAAW,GAAG,IAAI;QAU/B,MAAM,CAAC,MAAM,WAAW,EAAE,MAAM,QAAQ,GAAG,IAAI;QAM/C,QAAQ,CAAC,MAAM,WAAW,GAAG,IAAI;QAIxC,SAAS,CAAC,aAAa,CAAC,OAAO,QAAQ;QAOvC,SAAS,CAAC,YAAY,CAAC,OAAO,QAAQ,EAAE,MAAM,QAAQ,GAAG,IAAI;QAsB7D,SAAS,CAAC,MAAM,CAAC,OAAO,QAAQ,EAAE,MAAM,MAAM;KAiB/C"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
define("index", ["require", "exports", "fs", "path"], function (require, exports, fs_1, path_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
/**
|
|
5
|
-
* This class reports all relevant test statistics to a JSON file located at
|
|
6
|
-
* `{testLocation}.spec.json`.
|
|
7
|
-
*/
|
|
8
|
-
class JSONReporter {
|
|
9
|
-
file = null;
|
|
10
|
-
first = true;
|
|
11
|
-
onEnter(ctx) {
|
|
12
|
-
const extension = (0, path_1.extname)(ctx.fileName);
|
|
13
|
-
const dir = (0, path_1.dirname)(ctx.fileName);
|
|
14
|
-
const base = (0, path_1.basename)(ctx.fileName, extension);
|
|
15
|
-
const outPath = (0, path_1.join)(process.cwd(), dir, base + ".json");
|
|
16
|
-
this.file = (0, fs_1.createWriteStream)(outPath, "utf8");
|
|
17
|
-
this.file.write("[");
|
|
18
|
-
this.first = true;
|
|
19
|
-
}
|
|
20
|
-
onExit(_ctx, node) {
|
|
21
|
-
if (node.type === 1 /* TestNodeType.Group */) {
|
|
22
|
-
this.onGroupFinish(node);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
onFinish(_ctx) {
|
|
26
|
-
this.file.end();
|
|
27
|
-
}
|
|
28
|
-
onGroupFinish(group) {
|
|
29
|
-
if (group.children.length === 0)
|
|
30
|
-
return;
|
|
31
|
-
group.groupTests.forEach((test) => this.onTestFinish(group, test));
|
|
32
|
-
group.groupTodos.forEach((desc) => this.onTodo(group, desc));
|
|
33
|
-
}
|
|
34
|
-
onTestFinish(group, test) {
|
|
35
|
-
this.file.write((this.first ? "\n" : ",\n") +
|
|
36
|
-
JSON.stringify({
|
|
37
|
-
group: group.name,
|
|
38
|
-
name: test.name,
|
|
39
|
-
ran: test.ran,
|
|
40
|
-
pass: test.pass,
|
|
41
|
-
negated: test.negated,
|
|
42
|
-
runtime: test.deltaT,
|
|
43
|
-
message: test.message,
|
|
44
|
-
actual: test.actual ? test.actual.stringify({ indent: 0 }) : null,
|
|
45
|
-
expected: test.expected
|
|
46
|
-
? `${test.negated ? "Not " : ""}${test.expected.stringify({
|
|
47
|
-
indent: 0,
|
|
48
|
-
})}`
|
|
49
|
-
: null,
|
|
50
|
-
}));
|
|
51
|
-
this.first = false;
|
|
52
|
-
}
|
|
53
|
-
onTodo(group, desc) {
|
|
54
|
-
this.file.write((this.first ? "\n" : ",\n") +
|
|
55
|
-
JSON.stringify({
|
|
56
|
-
group: group.name,
|
|
57
|
-
name: "TODO: " + desc,
|
|
58
|
-
ran: false,
|
|
59
|
-
pass: null,
|
|
60
|
-
negated: false,
|
|
61
|
-
runtime: 0,
|
|
62
|
-
message: "",
|
|
63
|
-
actual: null,
|
|
64
|
-
expected: null,
|
|
65
|
-
}));
|
|
66
|
-
this.first = false;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
exports.default = JSONReporter;
|
|
70
|
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