@haibun/out-xunit 1.43.0 → 1.44.1
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/build/out-xunit.d.ts +33 -8
- package/build/out-xunit.d.ts.map +1 -1
- package/build/out-xunit.js +39 -13
- package/build/out-xunit.js.map +1 -1
- package/package.json +2 -2
package/build/out-xunit.d.ts
CHANGED
|
@@ -1,18 +1,43 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AStorage } from '@haibun/domain-storage/build/AStorage.js';
|
|
2
|
+
import { AStepper, TWorld, TExecutorResult, TNotOkStepActionResult, IProcessFeatureResults, IHasOptions } from '@haibun/core/build/lib/defs.js';
|
|
2
3
|
type TFailResult = {
|
|
3
4
|
'@message': string;
|
|
4
5
|
'@type': string;
|
|
5
6
|
type?: string;
|
|
6
7
|
};
|
|
7
|
-
export default class OutXUnit implements
|
|
8
|
+
export default class OutXUnit extends AStepper implements IProcessFeatureResults, IHasOptions {
|
|
9
|
+
options: {
|
|
10
|
+
OUTPUT_FILE: {
|
|
11
|
+
desc: string;
|
|
12
|
+
parse: (port: string) => {
|
|
13
|
+
parseError: string;
|
|
14
|
+
result?: undefined;
|
|
15
|
+
} | {
|
|
16
|
+
result: string;
|
|
17
|
+
parseError?: undefined;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
STORAGE: {
|
|
21
|
+
desc: string;
|
|
22
|
+
parse: (input: string) => {
|
|
23
|
+
parseError: string;
|
|
24
|
+
result?: undefined;
|
|
25
|
+
} | {
|
|
26
|
+
result: string;
|
|
27
|
+
parseError?: undefined;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
storage?: AStorage;
|
|
32
|
+
name: string;
|
|
33
|
+
prettyPrint: boolean;
|
|
34
|
+
classname: string;
|
|
35
|
+
outputFile: string;
|
|
8
36
|
setWorld(world: TWorld, steppers: AStepper[]): Promise<void>;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
prettyPrint?: boolean;
|
|
12
|
-
classname?: string;
|
|
13
|
-
}): Promise<string>;
|
|
14
|
-
writeOutput(result: TExecutorResult, args: any): Promise<string>;
|
|
37
|
+
processFeatureResult(result: TExecutorResult): Promise<void>;
|
|
38
|
+
featureResultAsJunit(result: TExecutorResult): Promise<string>;
|
|
15
39
|
getFailResult(failure: TNotOkStepActionResult): TFailResult;
|
|
40
|
+
steps: {};
|
|
16
41
|
}
|
|
17
42
|
export {};
|
|
18
43
|
//# sourceMappingURL=out-xunit.d.ts.map
|
package/build/out-xunit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"out-xunit.d.ts","sourceRoot":"","sources":["../src/out-xunit.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,sBAAsB,EAAE,
|
|
1
|
+
{"version":3,"file":"out-xunit.d.ts","sourceRoot":"","sources":["../src/out-xunit.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AAEpE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,WAAW,EAAa,MAAM,gCAAgC,CAAC;AAc3J,KAAK,WAAW,GAAG;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,QAAS,YAAW,sBAAsB,EAAE,WAAW;IAC5F,OAAO;;;0BAGS,MAAM;;;;;;;;;;2BAIL,MAAM;;;;;;;;MAErB;IAEF,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,IAAI,SAAkB;IACtB,WAAW,UAAQ;IACnB,SAAS,SAAwB;IACjC,UAAU,EAAE,MAAM,CAAC;IAEb,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE;IAM5C,oBAAoB,CAAC,MAAM,EAAE,eAAe;IAS5C,oBAAoB,CAAC,MAAM,EAAE,eAAe;IAkClD,aAAa,CAAC,OAAO,EAAE,sBAAsB;IAQ7C,KAAK,KAAM;CACX"}
|
package/build/out-xunit.js
CHANGED
|
@@ -1,20 +1,50 @@
|
|
|
1
1
|
import { create } from 'xmlbuilder2';
|
|
2
2
|
import { EOL } from 'os';
|
|
3
|
-
|
|
3
|
+
import { findStepperFromOption, getStepperOption, stringOrError } from '@haibun/core/build/lib/util/index.js';
|
|
4
|
+
import { AStepper } from '@haibun/core/build/lib/defs.js';
|
|
5
|
+
import { MEDIA_TYPES } from '@haibun/domain-storage/build/media-types.js';
|
|
6
|
+
const STORAGE = 'STORAGE';
|
|
7
|
+
export default class OutXUnit extends AStepper {
|
|
8
|
+
options = {
|
|
9
|
+
OUTPUT_FILE: {
|
|
10
|
+
desc: `output file (default junit.xml)`,
|
|
11
|
+
parse: (port) => stringOrError(port),
|
|
12
|
+
},
|
|
13
|
+
[STORAGE]: {
|
|
14
|
+
desc: 'Storage for output (default stdout)',
|
|
15
|
+
parse: (input) => stringOrError(input),
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
storage;
|
|
19
|
+
name = 'Haibun-Junit';
|
|
20
|
+
prettyPrint = true;
|
|
21
|
+
classname = 'Haibun-Junit-Suite';
|
|
22
|
+
outputFile;
|
|
4
23
|
async setWorld(world, steppers) {
|
|
5
|
-
|
|
24
|
+
this.outputFile = getStepperOption(this, 'OUTPUT_FILE', world.moduleOptions) || 'junit.xml';
|
|
25
|
+
this.storage = findStepperFromOption(steppers, this, world.moduleOptions, STORAGE);
|
|
26
|
+
await Promise.resolve();
|
|
6
27
|
}
|
|
7
|
-
async
|
|
28
|
+
async processFeatureResult(result) {
|
|
29
|
+
const junit = await this.featureResultAsJunit(result);
|
|
30
|
+
if (this.storage && this.outputFile) {
|
|
31
|
+
await this.storage.writeFileBuffer(this.outputFile, Buffer.from(junit), MEDIA_TYPES.xml);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
console.info(junit);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async featureResultAsJunit(result) {
|
|
8
38
|
const failures = result.featureResults?.filter((t) => !t.ok)?.length || 0;
|
|
9
39
|
const skipped = result.featureResults?.filter((t) => t.skip)?.length || 0;
|
|
10
40
|
const count = result.featureResults?.length || 0;
|
|
11
41
|
const forXML = {
|
|
12
42
|
testsuites: {
|
|
13
43
|
'@tests': count,
|
|
14
|
-
'@name': name,
|
|
44
|
+
'@name': this.name,
|
|
15
45
|
'@failures': failures,
|
|
16
46
|
testsuite: {
|
|
17
|
-
'@name': classname,
|
|
47
|
+
'@name': this.classname,
|
|
18
48
|
'@tests': count,
|
|
19
49
|
'@skipped': skipped,
|
|
20
50
|
'@failures': failures,
|
|
@@ -22,7 +52,7 @@ export default class OutXUnit {
|
|
|
22
52
|
},
|
|
23
53
|
},
|
|
24
54
|
};
|
|
25
|
-
for (const t of result.featureResults) {
|
|
55
|
+
for (const t of result.featureResults || []) {
|
|
26
56
|
const testCase = {
|
|
27
57
|
'@name': t.path,
|
|
28
58
|
'@id': t.path,
|
|
@@ -30,15 +60,10 @@ export default class OutXUnit {
|
|
|
30
60
|
if (!t.ok) {
|
|
31
61
|
testCase.failure = this.getFailResult(t.stepResults.find((r) => !r.ok)?.actionResult);
|
|
32
62
|
}
|
|
33
|
-
// if (t.comments) {
|
|
34
|
-
// testCase['system-out'] = t.comments;
|
|
35
|
-
// }
|
|
36
63
|
forXML.testsuites.testsuite.testcase.push(testCase);
|
|
37
64
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
async writeOutput(result, args) {
|
|
41
|
-
return this.getOutput(result, args);
|
|
65
|
+
const junit = create(forXML).end({ prettyPrint: this.prettyPrint, newline: EOL });
|
|
66
|
+
return Promise.resolve(junit);
|
|
42
67
|
}
|
|
43
68
|
getFailResult(failure) {
|
|
44
69
|
const failResult = {
|
|
@@ -47,5 +72,6 @@ export default class OutXUnit {
|
|
|
47
72
|
};
|
|
48
73
|
return failResult;
|
|
49
74
|
}
|
|
75
|
+
steps = {};
|
|
50
76
|
}
|
|
51
77
|
//# sourceMappingURL=out-xunit.js.map
|
package/build/out-xunit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"out-xunit.js","sourceRoot":"","sources":["../src/out-xunit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"out-xunit.js","sourceRoot":"","sources":["../src/out-xunit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,IAAI,CAAC;AAGzB,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAC9G,OAAO,EAAE,QAAQ,EAAmG,MAAM,gCAAgC,CAAC;AAC3J,OAAO,EAAE,WAAW,EAAc,MAAM,6CAA6C,CAAC;AAEtF,MAAM,OAAO,GAAG,SAAS,CAAC;AAiB1B,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,QAAQ;IAC7C,OAAO,GAAG;QACT,WAAW,EAAE;YACZ,IAAI,EAAE,iCAAiC;YACvC,KAAK,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC;SAC5C;QACD,CAAC,OAAO,CAAC,EAAE;YACV,IAAI,EAAE,qCAAqC;YAC3C,KAAK,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC;SAC9C;KACD,CAAC;IAEF,OAAO,CAAY;IACnB,IAAI,GAAG,cAAc,CAAC;IACtB,WAAW,GAAG,IAAI,CAAC;IACnB,SAAS,GAA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
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haibun/out-xunit",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.44.1",
|
|
5
5
|
"description": "",
|
|
6
6
|
"files": ["build/**"],
|
|
7
7
|
"main": "build/out-xunit.js",
|
|
@@ -16,6 +16,6 @@
|
|
|
16
16
|
"keywords": [],
|
|
17
17
|
"author": "",
|
|
18
18
|
"license": "ISC",
|
|
19
|
-
"dependencies": { "@haibun/core": "1.
|
|
19
|
+
"dependencies": { "@haibun/core": "1.44.1", "xmlbuilder2": "^3.0.2" },
|
|
20
20
|
"gitHead": "7cf9680bd922fb622fb59f1e6bf5b65284cb8fd5"
|
|
21
21
|
}
|