allure-js-commons 3.0.0-beta.2 → 3.0.0-beta.4
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/cjs/facade.js +0 -2
- package/dist/cjs/facade.js.map +1 -1
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model.js +1 -0
- package/dist/cjs/model.js.map +1 -1
- package/dist/cjs/sdk/index.js.map +1 -1
- package/dist/cjs/sdk/reporter/LifecycleState.js +8 -9
- package/dist/cjs/sdk/reporter/LifecycleState.js.map +1 -1
- package/dist/cjs/sdk/reporter/ReporterRuntime.js +304 -755
- package/dist/cjs/sdk/reporter/ReporterRuntime.js.map +1 -1
- package/dist/cjs/sdk/reporter/index.js +0 -7
- package/dist/cjs/sdk/reporter/index.js.map +1 -1
- package/dist/cjs/sdk/reporter/testplan.js +19 -1
- package/dist/cjs/sdk/reporter/testplan.js.map +1 -1
- package/dist/cjs/sdk/reporter/types.js +1 -2
- package/dist/cjs/sdk/reporter/types.js.map +1 -1
- package/dist/cjs/sdk/reporter/utils.js +56 -2
- package/dist/cjs/sdk/reporter/utils.js.map +1 -1
- package/dist/cjs/sdk/reporter/writer/FileSystemWriter.js +1 -3
- package/dist/cjs/sdk/reporter/writer/FileSystemWriter.js.map +1 -1
- package/dist/cjs/sdk/reporter/writer/MessageReader.js +39 -0
- package/dist/cjs/sdk/reporter/writer/MessageReader.js.map +1 -1
- package/dist/cjs/sdk/reporter/writer/MessageWriter.js +1 -3
- package/dist/cjs/sdk/reporter/writer/MessageWriter.js.map +1 -1
- package/dist/cjs/sdk/runtime/MessageTestRuntime.js +4 -4
- package/dist/cjs/sdk/runtime/MessageTestRuntime.js.map +1 -1
- package/dist/cjs/sdk/types.js.map +1 -1
- package/dist/esm/facade.js +0 -3
- package/dist/esm/facade.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model.js +1 -0
- package/dist/esm/model.js.map +1 -1
- package/dist/esm/sdk/index.js.map +1 -1
- package/dist/esm/sdk/reporter/LifecycleState.js +8 -9
- package/dist/esm/sdk/reporter/LifecycleState.js.map +1 -1
- package/dist/esm/sdk/reporter/ReporterRuntime.js +305 -757
- package/dist/esm/sdk/reporter/ReporterRuntime.js.map +1 -1
- package/dist/esm/sdk/reporter/index.js +1 -1
- package/dist/esm/sdk/reporter/index.js.map +1 -1
- package/dist/esm/sdk/reporter/testplan.js +17 -0
- package/dist/esm/sdk/reporter/testplan.js.map +1 -1
- package/dist/esm/sdk/reporter/types.js +0 -1
- package/dist/esm/sdk/reporter/types.js.map +1 -1
- package/dist/esm/sdk/reporter/utils.js +52 -2
- package/dist/esm/sdk/reporter/utils.js.map +1 -1
- package/dist/esm/sdk/reporter/writer/FileSystemWriter.js +1 -3
- package/dist/esm/sdk/reporter/writer/FileSystemWriter.js.map +1 -1
- package/dist/esm/sdk/reporter/writer/MessageReader.js +40 -1
- package/dist/esm/sdk/reporter/writer/MessageReader.js.map +1 -1
- package/dist/esm/sdk/reporter/writer/MessageWriter.js +1 -3
- package/dist/esm/sdk/reporter/writer/MessageWriter.js.map +1 -1
- package/dist/esm/sdk/runtime/MessageTestRuntime.js +5 -5
- package/dist/esm/sdk/runtime/MessageTestRuntime.js.map +1 -1
- package/dist/esm/sdk/types.js.map +1 -1
- package/dist/types/facade.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/model.d.ts +1 -0
- package/dist/types/sdk/index.d.ts +1 -1
- package/dist/types/sdk/reporter/LifecycleState.d.ts +4 -4
- package/dist/types/sdk/reporter/ReporterRuntime.d.ts +26 -239
- package/dist/types/sdk/reporter/index.d.ts +1 -1
- package/dist/types/sdk/reporter/testplan.d.ts +5 -0
- package/dist/types/sdk/reporter/types.d.ts +8 -39
- package/dist/types/sdk/reporter/utils.d.ts +6 -3
- package/dist/types/sdk/reporter/writer/MessageReader.d.ts +1 -0
- package/dist/types/sdk/types.d.ts +5 -8
- package/package.json +1 -1
- package/dist/cjs/sdk/reporter/context/AllureContextProviderBase.js +0 -83
- package/dist/cjs/sdk/reporter/context/AllureContextProviderBase.js.map +0 -1
- package/dist/cjs/sdk/reporter/context/StaticAllureContextProvider.js +0 -122
- package/dist/cjs/sdk/reporter/context/StaticAllureContextProvider.js.map +0 -1
- package/dist/cjs/sdk/reporter/context/types.js +0 -2
- package/dist/cjs/sdk/reporter/context/types.js.map +0 -1
- package/dist/esm/sdk/reporter/context/AllureContextProviderBase.js +0 -76
- package/dist/esm/sdk/reporter/context/AllureContextProviderBase.js.map +0 -1
- package/dist/esm/sdk/reporter/context/StaticAllureContextProvider.js +0 -113
- package/dist/esm/sdk/reporter/context/StaticAllureContextProvider.js.map +0 -1
- package/dist/esm/sdk/reporter/context/types.js +0 -2
- package/dist/esm/sdk/reporter/context/types.js.map +0 -1
- package/dist/types/sdk/reporter/context/AllureContextProviderBase.d.ts +0 -31
- package/dist/types/sdk/reporter/context/StaticAllureContextProvider.d.ts +0 -52
- package/dist/types/sdk/reporter/context/types.d.ts +0 -43
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageReader.js","names":["parseProperties","parseJsonResult","data","JSON","parse","Buffer","from","toString","MessageReader","constructor","_defineProperty","tests","groups","attachments","jsonMessage","path","type","results","push","envInfo","categories"],"sources":["../../../../../src/sdk/reporter/writer/MessageReader.ts"],"sourcesContent":["import type { TestResult, TestResultContainer } from \"../../../model.js\";\nimport type { AllureResults, EnvironmentInfo } from \"../../types.js\";\nimport { parseProperties } from \"../utils.js\";\n\nconst parseJsonResult = <T>(data: string) => {\n return JSON.parse(Buffer.from(data, \"base64\").toString(\"utf-8\")) as T;\n};\n\nexport class MessageReader {\n readonly results: AllureResults = {\n tests: [],\n groups: [],\n attachments: {},\n };\n\n handleMessage = (jsonMessage: string) => {\n const { path, type = \"undefined\", data }: { path: string; type?: string; data: string } = JSON.parse(jsonMessage);\n\n switch (type) {\n case \"container\":\n this.results.groups.push(parseJsonResult<TestResultContainer>(data));\n return;\n case \"result\":\n this.results.tests.push(parseJsonResult<TestResult>(data));\n return;\n case \"attachment\":\n this.results.attachments[path] = data;\n return;\n case \"misc\":\n switch (path) {\n case \"environment.properties\":\n this.results.envInfo = parseProperties(Buffer.from(data, \"base64\").toString()) as EnvironmentInfo;\n break;\n case \"categories.json\":\n this.results.categories = parseJsonResult(data);\n break;\n default:\n break;\n }\n return;\n default:\n return;\n }\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"MessageReader.js","names":["attachment","step","parseProperties","stringifyProperties","parseJsonResult","data","JSON","parse","Buffer","from","toString","MessageReader","constructor","_this","_defineProperty","tests","groups","attachments","jsonMessage","path","type","results","push","envInfo","categories","_asyncToGenerator","stringify","key","Object","keys","content","contentType","encoding","tr","concat","uuid","trc"],"sources":["../../../../../src/sdk/reporter/writer/MessageReader.ts"],"sourcesContent":["import { attachment, step } from \"../../../facade.js\";\nimport type { TestResult, TestResultContainer } from \"../../../model.js\";\nimport type { AllureResults, EnvironmentInfo } from \"../../types.js\";\nimport { parseProperties, stringifyProperties } from \"../utils.js\";\n\nconst parseJsonResult = <T>(data: string) => {\n return JSON.parse(Buffer.from(data, \"base64\").toString(\"utf-8\")) as T;\n};\n\nexport class MessageReader {\n readonly results: AllureResults = {\n tests: [],\n groups: [],\n attachments: {},\n };\n\n handleMessage = (jsonMessage: string) => {\n const { path, type = \"undefined\", data }: { path: string; type?: string; data: string } = JSON.parse(jsonMessage);\n\n switch (type) {\n case \"container\":\n this.results.groups.push(parseJsonResult<TestResultContainer>(data));\n return;\n case \"result\":\n this.results.tests.push(parseJsonResult<TestResult>(data));\n return;\n case \"attachment\":\n this.results.attachments[path] = data;\n return;\n case \"misc\":\n switch (path) {\n case \"environment.properties\":\n this.results.envInfo = parseProperties(Buffer.from(data, \"base64\").toString()) as EnvironmentInfo;\n break;\n case \"categories.json\":\n this.results.categories = parseJsonResult(data);\n break;\n default:\n break;\n }\n return;\n default:\n return;\n }\n };\n\n attachResults = async () => {\n await step(\"allure-results\", async () => {\n if (this.results.categories) {\n await attachment(\"categories.json\", JSON.stringify(this.results.categories), \"application/json\");\n }\n if (this.results.envInfo) {\n await attachment(\"environment.properties\", stringifyProperties(this.results.envInfo), \"text/plain\");\n }\n if (this.results.attachments) {\n for (const key of Object.keys(this.results.attachments)) {\n const content = this.results.attachments[key];\n await attachment(key, content, {\n contentType: \"text/plain\",\n encoding: \"base64\",\n });\n }\n }\n if (this.results.tests) {\n for (const tr of this.results.tests) {\n await attachment(`${tr.uuid}-result.json`, JSON.stringify(tr, null, 2), {\n contentType: \"application/json\",\n encoding: \"utf-8\",\n });\n }\n }\n if (this.results.groups) {\n for (const trc of this.results.groups) {\n await attachment(`${trc.uuid}-container.json`, JSON.stringify(trc, null, 2), {\n contentType: \"application/json\",\n encoding: \"utf-8\",\n });\n }\n }\n });\n };\n}\n"],"mappings":";;;;;AAAA,SAASA,UAAU,EAAEC,IAAI,QAAQ,oBAAoB;AAGrD,SAASC,eAAe,EAAEC,mBAAmB,QAAQ,aAAa;AAElE,IAAMC,eAAe,GAAOC,IAAY,IAAK;EAC3C,OAAOC,IAAI,CAACC,KAAK,CAACC,MAAM,CAACC,IAAI,CAACJ,IAAI,EAAE,QAAQ,CAAC,CAACK,QAAQ,CAAC,OAAO,CAAC,CAAC;AAClE,CAAC;AAED,OAAO,MAAMC,aAAa,CAAC;EAAAC,YAAA;IAAA,IAAAC,KAAA;IAAAC,eAAA,kBACS;MAChCC,KAAK,EAAE,EAAE;MACTC,MAAM,EAAE,EAAE;MACVC,WAAW,EAAE,CAAC;IAChB,CAAC;IAAAH,eAAA,wBAEgBI,WAAmB,IAAK;MACvC,IAAM;QAAEC,IAAI;QAAEC,IAAI,GAAG,WAAW;QAAEf;MAAoD,CAAC,GAAGC,IAAI,CAACC,KAAK,CAACW,WAAW,CAAC;MAEjH,QAAQE,IAAI;QACV,KAAK,WAAW;UACd,IAAI,CAACC,OAAO,CAACL,MA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AAO,GAAGjB,KAAI,CAACQ,OAAO,CAACJ,WAAW,CAACU,GAAG,CAAC;YAC7C,MAAM3B,UAAU,CAAC2B,GAAG,EAAEG,OAAO,EAAE;cAC7BC,WAAW,EAAE,YAAY;cACzBC,QAAQ,EAAE;YACZ,CAAC,CAAC;UACJ;QACF;QACA,IAAInB,KAAI,CAACQ,OAAO,CAACN,KAAK,EAAE;UACtB,KAAK,IAAMkB,EAAE,IAAIpB,KAAI,CAACQ,OAAO,CAACN,KAAK,EAAE;YACnC,MAAMf,UAAU,IAAAkC,MAAA,CAAID,EAAE,CAACE,IAAI,mBAAgB7B,IAAI,CAACoB,SAAS,CAACO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;cACtEF,WAAW,EAAE,kBAAkB;cAC/BC,QAAQ,EAAE;YACZ,CAAC,CAAC;UACJ;QACF;QACA,IAAInB,KAAI,CAACQ,OAAO,CAACL,MAAM,EAAE;UACvB,KAAK,IAAMoB,GAAG,IAAIvB,KAAI,CAACQ,OAAO,CAACL,MAAM,EAAE;YACrC,MAAMhB,UAAU,IAAAkC,MAAA,CAAIE,GAAG,CAACD,IAAI,sBAAmB7B,IAAI,CAACoB,SAAS,CAACU,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;cAC3EL,WAAW,EAAE,kBAAkB;cAC/BC,QAAQ,EAAE;YACZ,CAAC,CAAC;UACJ;QACF;MACF,CAAC,EAAC;IACJ,CAAC;EAAA;AACH","ignoreList":[]}
|
|
@@ -28,9 +28,7 @@ export class MessageWriter {
|
|
|
28
28
|
this.sendData(distFileName, "attachment", readFileSync(from));
|
|
29
29
|
}
|
|
30
30
|
writeEnvironmentInfo(info) {
|
|
31
|
-
var text = stringifyProperties(info
|
|
32
|
-
unicode: true
|
|
33
|
-
}).toString();
|
|
31
|
+
var text = stringifyProperties(info);
|
|
34
32
|
this.sendData("environment.properties", "misc", Buffer.from(text, "utf-8"));
|
|
35
33
|
}
|
|
36
34
|
writeCategoriesDefinitions(categories) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageWriter.js","names":["readFileSync","process","stringifyProperties","MessageWriter","constructor","bus","sendData","path","type","data","_process$send","event","toString","emit","JSON","stringify","send","call","writeJson","Buffer","from","writeAttachment","distFileName","content","writeAttachmentFromPath","writeEnvironmentInfo","info","text","
|
|
1
|
+
{"version":3,"file":"MessageWriter.js","names":["readFileSync","process","stringifyProperties","MessageWriter","constructor","bus","sendData","path","type","data","_process$send","event","toString","emit","JSON","stringify","send","call","writeJson","Buffer","from","writeAttachment","distFileName","content","writeAttachmentFromPath","writeEnvironmentInfo","info","text","writeCategoriesDefinitions","categories","writeGroup","result","concat","uuid","writeResult"],"sources":["../../../../../src/sdk/reporter/writer/MessageWriter.ts"],"sourcesContent":["import { readFileSync } from \"fs\";\nimport type { EventEmitter } from \"node:events\";\nimport process from \"process\";\nimport type { TestResult, TestResultContainer } from \"../../../model.js\";\nimport type { Category, EnvironmentInfo } from \"../../types.js\";\nimport type { Writer } from \"../types.js\";\nimport { stringifyProperties } from \"../utils.js\";\n\ntype EventType = \"result\" | \"container\" | \"attachment\" | \"misc\";\n\nexport class MessageWriter implements Writer {\n constructor(private bus?: EventEmitter) {}\n\n private sendData(path: string, type: EventType, data: Buffer) {\n const event = { path, type, data: data.toString(\"base64\") };\n\n if (this.bus) {\n this.bus.emit(\"allureWriterMessage\", JSON.stringify(event));\n return;\n }\n\n process.send?.(JSON.stringify(event));\n }\n\n private writeJson(path: string, type: EventType, data: any) {\n this.sendData(path, type, Buffer.from(JSON.stringify(data), \"utf-8\"));\n }\n\n writeAttachment(distFileName: string, content: Buffer): void {\n this.sendData(distFileName, \"attachment\", content);\n }\n\n writeAttachmentFromPath(distFileName: string, from: string): void {\n this.sendData(distFileName, \"attachment\", readFileSync(from));\n }\n\n writeEnvironmentInfo(info: EnvironmentInfo): void {\n const text = stringifyProperties(info);\n\n this.sendData(\"environment.properties\", \"misc\", Buffer.from(text, \"utf-8\"));\n }\n\n writeCategoriesDefinitions(categories: Category[]): void {\n this.writeJson(\"categories.json\", \"misc\", categories);\n }\n\n writeGroup(result: TestResultContainer): void {\n this.writeJson(`${result.uuid}-container.json`, \"container\", result);\n }\n\n writeResult(result: TestResult): void {\n this.writeJson(`${result.uuid}-result.json`, \"result\", result);\n }\n}\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,IAAI;AAEjC,OAAOC,OAAO,MAAM,SAAS;AAI7B,SAASC,mBAAmB,QAAQ,aAAa;AAIjD,OAAO,MAAMC,aAAa,CAAmB;EAC3CC,WAAWA,CAASC,GAAkB,EAAE;IAAA,KAApBA,GAAkB,GAAlBA,GAAkB;EAAG;EAEjCC,QAAQA,CAACC,IAAY,EAAEC,IAAe,EAAEC,IAAY,EAAE;IAAA,IAAAC,aAAA;IAC5D,IAAMC,KAAK,GAAG;MAAEJ,IAAI;MAAEC,IAAI;MAAEC,IAAI,EAAEA,IAAI,CAACG,QAAQ,CAAC,QAAQ;IAAE,CAAC;IAE3D,IAAI,IAAI,CAACP,GAAG,EAAE;MACZ,IAAI,CAACA,GAAG,CAACQ,IAAI,CAAC,qBAAqB,EAAEC,IAAI,CAACC,SAAS,CAACJ,KAAK,CAAC,CAAC;MAC3D;IACF;IAEA,CAAAD,aAAA,GAAAT,OAAO,CAACe,IAAI,cAAAN,aAAA,eAAZA,aAAA,CAAAO,IAAA,CAAAhB,OAAO,EAAQa,IAAI,CAACC,SAAS,CAACJ,KAAK,CAAC,CAAC;EACvC;EAEQO,SAASA,CAACX,IAAY,EAAEC,IAAe,EAAEC,IAAS,EAAE;IAC1D,IAAI,CAACH,QAAQ,CAACC,IAAI,EAAEC,IAAI,EAAEW,MAAM,CAACC,IAAI,CAACN,IAAI,CAACC,SAAS,CAACN,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;EACvE;EAEAY,eAAeA,CAACC,YAAoB,EAAEC,OAAe,EAAQ;IAC3D,IAAI,CAACjB,QAAQ,CAACgB,YAAY,EAAE,YAAY,EAAEC,OAAO,CAAC;EACpD;EAEAC,uBAAuBA,CAACF,YAAoB,EAAEF,IAAY,EAAQ;IAChE,IAAI,CAACd,QAAQ,CAACgB,YAAY,EAAE,YAAY,EAAEtB,YAAY,CAACoB,IAAI,CAAC,CAAC;EAC/D;EAEAK,oBAAoBA,CAACC,IAAqB,EAAQ;IAChD,IAAMC,IAAI,GAAGzB,mBAAmB,CAACwB,IAAI,CAAC;IAEtC,IAAI,CAACpB,QAAQ,CAAC,wBAAwB,EAAE,MAAM,EAAEa,MAAM,CAACC,IAAI,CAACO,IAAI,EAAE,OAAO,CAAC,CAAC;EAC7E;EAEAC,0BAA0BA,CAACC,UAAsB,EAAQ;IACvD,IAAI,CAACX,SAAS,CAAC,iBAAiB,EAAE,MAAM,EAAEW,UAAU,CAAC;EACvD;EAEAC,UAAUA,CAACC,MAA2B,EAAQ;IAC5C,IAAI,CAACb,SAAS,IAAAc,MAAA,CAAID,MAAM,CAACE,IAAI,sBAAmB,WAAW,EAAEF,MAAM,CAAC;EACtE;EAEAG,WAAWA,CAACH,MAAkB,EAAQ;IACpC,IAAI,CAACb,SAAS,IAAAc,MAAA,CAAID,MAAM,CAACE,IAAI,mBAAgB,QAAQ,EAAEF,MAAM,CAAC;EAChE;AACF","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
5
5
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
6
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
7
7
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
8
|
-
import {
|
|
8
|
+
import { Status } from "../../model.js";
|
|
9
9
|
import { getStatusFromError } from "../utils.js";
|
|
10
10
|
export class MessageTestRuntime {
|
|
11
11
|
label(name, value) {
|
|
@@ -148,7 +148,8 @@ export class MessageTestRuntime {
|
|
|
148
148
|
encoding: "base64",
|
|
149
149
|
contentType: options.contentType,
|
|
150
150
|
fileExtension: options.fileExtension,
|
|
151
|
-
wrapInStep: true
|
|
151
|
+
wrapInStep: true,
|
|
152
|
+
timestamp: Date.now()
|
|
152
153
|
}
|
|
153
154
|
});
|
|
154
155
|
})();
|
|
@@ -163,7 +164,8 @@ export class MessageTestRuntime {
|
|
|
163
164
|
path,
|
|
164
165
|
contentType: options.contentType,
|
|
165
166
|
fileExtension: options.fileExtension,
|
|
166
|
-
wrapInStep: true
|
|
167
|
+
wrapInStep: true,
|
|
168
|
+
timestamp: Date.now()
|
|
167
169
|
}
|
|
168
170
|
});
|
|
169
171
|
})();
|
|
@@ -184,7 +186,6 @@ export class MessageTestRuntime {
|
|
|
184
186
|
type: "step_stop",
|
|
185
187
|
data: {
|
|
186
188
|
status: Status.PASSED,
|
|
187
|
-
stage: Stage.FINISHED,
|
|
188
189
|
stop: Date.now()
|
|
189
190
|
}
|
|
190
191
|
});
|
|
@@ -198,7 +199,6 @@ export class MessageTestRuntime {
|
|
|
198
199
|
type: "step_stop",
|
|
199
200
|
data: {
|
|
200
201
|
status: getStatusFromError(err),
|
|
201
|
-
stage: Stage.FINISHED,
|
|
202
202
|
stop: Date.now(),
|
|
203
203
|
statusDetails: {
|
|
204
204
|
message: _message,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageTestRuntime.js","names":["Stage","Status","getStatusFromError","MessageTestRuntime","label","name","value","_this","_asyncToGenerator","sendMessage","type","data","labels","_arguments","arguments","_this2","_len","length","Array","_key","link","url","_this3","links","_arguments2","_this4","_len2","_key2","parameter","options","_this5","parameters","_objectSpread","description","markdown","_this6","descriptionHtml","html","_this7","displayName","_this8","historyId","_this9","testCaseId","_this10","attachment","content","_this11","bufferContent","Buffer","from","encoding","toString","contentType","fileExtension","wrapInStep","attachmentFromPath","path","_this12","step","body","_this13","start","Date","now","result","status","PASSED","stage","FINISHED","stop","err","message","stack","statusDetails","trace","stepDisplayName","_this14","stepParameter","mode","_this15"],"sources":["../../../../src/sdk/runtime/MessageTestRuntime.ts"],"sourcesContent":["import type {\n AttachmentOptions,\n Label,\n LabelName,\n Link,\n LinkType,\n ParameterMode,\n ParameterOptions,\n} from \"../../model.js\";\nimport { Stage, Status } from \"../../model.js\";\nimport type { RuntimeMessage } from \"../types.js\";\nimport { getStatusFromError } from \"../utils.js\";\nimport type { TestRuntime } from \"./types.js\";\n\nexport abstract class MessageTestRuntime implements TestRuntime {\n async label(name: LabelName | string, value: string) {\n await this.sendMessage({\n type: \"metadata\",\n data: {\n labels: [{ name, value }],\n },\n });\n }\n\n async labels(...labels: Label[]) {\n await this.sendMessage({\n type: \"metadata\",\n data: {\n labels,\n },\n });\n }\n\n async link(url: string, type?: LinkType | string, name?: string) {\n await this.sendMessage({\n type: \"metadata\",\n data: {\n links: [{ type, url, name }],\n },\n });\n }\n\n async links(...links: Link[]) {\n await this.sendMessage({\n type: \"metadata\",\n data: {\n links,\n },\n });\n }\n\n async parameter(name: string, value: string, options?: ParameterOptions) {\n await this.sendMessage({\n type: \"metadata\",\n data: {\n parameters: [\n {\n name,\n value,\n ...options,\n },\n ],\n },\n });\n }\n\n async description(markdown: string) {\n await this.sendMessage({\n type: \"metadata\",\n data: {\n description: markdown,\n },\n });\n }\n\n async descriptionHtml(html: string) {\n await this.sendMessage({\n type: \"metadata\",\n data: {\n descriptionHtml: html,\n },\n });\n }\n\n async displayName(name: string) {\n await this.sendMessage({\n type: \"metadata\",\n data: {\n displayName: name,\n },\n });\n }\n\n async historyId(value: string) {\n await this.sendMessage({\n type: \"metadata\",\n data: {\n historyId: value,\n },\n });\n }\n\n async testCaseId(value: string) {\n await this.sendMessage({\n type: \"metadata\",\n data: {\n testCaseId: value,\n },\n });\n }\n\n async attachment(name: string, content: Buffer | string, options: AttachmentOptions) {\n const bufferContent = typeof content === \"string\" ? Buffer.from(content, options.encoding) : content;\n await this.sendMessage({\n type: \"attachment_content\",\n data: {\n name,\n content: bufferContent.toString(\"base64\"),\n encoding: \"base64\",\n contentType: options.contentType,\n fileExtension: options.fileExtension,\n wrapInStep: true,\n },\n });\n }\n\n async attachmentFromPath(name: string, path: string, options: AttachmentOptions) {\n await this.sendMessage({\n type: \"attachment_path\",\n data: {\n name,\n path,\n contentType: options.contentType,\n fileExtension: options.fileExtension,\n wrapInStep: true,\n },\n });\n }\n\n async step<T = void>(name: string, body: () => T | PromiseLike<T>) {\n await this.sendMessage({\n type: \"step_start\",\n data: {\n name,\n start: Date.now(),\n },\n });\n\n try {\n const result = await body();\n\n await this.sendMessage({\n type: \"step_stop\",\n data: {\n status: Status.PASSED,\n stage: Stage.FINISHED,\n stop: Date.now(),\n },\n });\n\n return result;\n } catch (err) {\n const { message, stack } = err as Error;\n\n await this.sendMessage({\n type: \"step_stop\",\n data: {\n status: getStatusFromError(err as Error),\n stage: Stage.FINISHED,\n stop: Date.now(),\n statusDetails: {\n message,\n trace: stack,\n },\n },\n });\n\n throw err;\n }\n }\n\n async stepDisplayName(name: string) {\n await this.sendMessage({\n type: \"step_metadata\",\n data: { name },\n });\n }\n\n async stepParameter(name: string, value: string, mode?: ParameterMode) {\n await this.sendMessage({\n type: \"step_metadata\",\n data: {\n parameters: [{ name, value, mode }],\n },\n });\n }\n\n abstract sendMessage(message: RuntimeMessage): Promise<void>;\n}\n"],"mappings":";;;;;;;AASA,SAASA,KAAK,EAAEC,MAAM,QAAQ,gBAAgB;AAE9C,SAASC,kBAAkB,QAAQ,aAAa;AAGhD,OAAO,MAAeC,kBA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AEC,KAAa,EAAEyE,IAAoB,EAAE;IAAA,IAAAC,OAAA;IAAA,OAAAxE,iBAAA;MACrE,MAAMwE,OAAI,CAACvE,WAAW,CAAC;QACrBC,IAAI,EAAE,eAAe;QACrBC,IAAI,EAAE;UACJoB,UAAU,EAAE,CAAC;YAAE1B,IAAI;YAAEC,KAAK;YAAEyE;UAAK,CAAC;QACpC;MACF,CAAC,CAAC;IAAC;EACL;AAGF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"MessageTestRuntime.js","names":["Status","getStatusFromError","MessageTestRuntime","label","name","value","_this","_asyncToGenerator","sendMessage","type","data","labels","_arguments","arguments","_this2","_len","length","Array","_key","link","url","_this3","links","_arguments2","_this4","_len2","_key2","parameter","options","_this5","parameters","_objectSpread","description","markdown","_this6","descriptionHtml","html","_this7","displayName","_this8","historyId","_this9","testCaseId","_this10","attachment","content","_this11","bufferContent","Buffer","from","encoding","toString","contentType","fileExtension","wrapInStep","timestamp","Date","now","attachmentFromPath","path","_this12","step","body","_this13","start","result","status","PASSED","stop","err","message","stack","statusDetails","trace","stepDisplayName","_this14","stepParameter","mode","_this15"],"sources":["../../../../src/sdk/runtime/MessageTestRuntime.ts"],"sourcesContent":["import type {\n AttachmentOptions,\n Label,\n LabelName,\n Link,\n LinkType,\n ParameterMode,\n ParameterOptions,\n} from \"../../model.js\";\nimport { Status } from \"../../model.js\";\nimport type { RuntimeMessage } from \"../types.js\";\nimport { getStatusFromError } from \"../utils.js\";\nimport type { TestRuntime } from \"./types.js\";\n\nexport abstract class MessageTestRuntime implements TestRuntime {\n async label(name: LabelName | string, value: string) {\n await this.sendMessage({\n type: \"metadata\",\n data: {\n labels: [{ name, value }],\n },\n });\n }\n\n async labels(...labels: Label[]) {\n await this.sendMessage({\n type: \"metadata\",\n data: {\n labels,\n },\n });\n }\n\n async link(url: string, type?: LinkType | string, name?: string) {\n await this.sendMessage({\n type: \"metadata\",\n data: {\n links: [{ type, url, name }],\n },\n });\n }\n\n async links(...links: Link[]) {\n await this.sendMessage({\n type: \"metadata\",\n data: {\n links,\n },\n });\n }\n\n async parameter(name: string, value: string, options?: ParameterOptions) {\n await this.sendMessage({\n type: \"metadata\",\n data: {\n parameters: [\n {\n name,\n value,\n ...options,\n },\n ],\n },\n });\n }\n\n async description(markdown: string) {\n await this.sendMessage({\n type: \"metadata\",\n data: {\n description: markdown,\n },\n });\n }\n\n async descriptionHtml(html: string) {\n await this.sendMessage({\n type: \"metadata\",\n data: {\n descriptionHtml: html,\n },\n });\n }\n\n async displayName(name: string) {\n await this.sendMessage({\n type: \"metadata\",\n data: {\n displayName: name,\n },\n });\n }\n\n async historyId(value: string) {\n await this.sendMessage({\n type: \"metadata\",\n data: {\n historyId: value,\n },\n });\n }\n\n async testCaseId(value: string) {\n await this.sendMessage({\n type: \"metadata\",\n data: {\n testCaseId: value,\n },\n });\n }\n\n async attachment(name: string, content: Buffer | string, options: AttachmentOptions) {\n const bufferContent = typeof content === \"string\" ? Buffer.from(content, options.encoding) : content;\n await this.sendMessage({\n type: \"attachment_content\",\n data: {\n name,\n content: bufferContent.toString(\"base64\"),\n encoding: \"base64\",\n contentType: options.contentType,\n fileExtension: options.fileExtension,\n wrapInStep: true,\n timestamp: Date.now(),\n },\n });\n }\n\n async attachmentFromPath(name: string, path: string, options: AttachmentOptions) {\n await this.sendMessage({\n type: \"attachment_path\",\n data: {\n name,\n path,\n contentType: options.contentType,\n fileExtension: options.fileExtension,\n wrapInStep: true,\n timestamp: Date.now(),\n },\n });\n }\n\n async step<T = void>(name: string, body: () => T | PromiseLike<T>) {\n await this.sendMessage({\n type: \"step_start\",\n data: {\n name,\n start: Date.now(),\n },\n });\n\n try {\n const result = await body();\n\n await this.sendMessage({\n type: \"step_stop\",\n data: {\n status: Status.PASSED,\n stop: Date.now(),\n },\n });\n\n return result;\n } catch (err) {\n const { message, stack } = err as Error;\n\n await this.sendMessage({\n type: \"step_stop\",\n data: {\n status: getStatusFromError(err as Error),\n stop: Date.now(),\n statusDetails: {\n message,\n trace: stack,\n },\n },\n });\n\n throw err;\n }\n }\n\n async stepDisplayName(name: string) {\n await this.sendMessage({\n type: \"step_metadata\",\n data: { name },\n });\n }\n\n async stepParameter(name: string, value: string, mode?: ParameterMode) {\n await this.sendMessage({\n type: \"step_metadata\",\n data: {\n parameters: [{ name, value, mode }],\n },\n });\n }\n\n abstract sendMessage(message: RuntimeMessage): Promise<void>;\n}\n"],"mappings":";;;;;;;AASA,SAASA,MAAM,QAAQ,gBAAgB;AAEvC,SAASC,kBAAkB,QAAQ,aAAa;AAGhD,OAAO,MAAeC,kBAAkB,CAAwB;EACxDC,KAAKA,CAACC,IAAwB,EAAEC,KAAa,EAAE;IAAA,IAAAC,KAAA;IAAA,OAAAC,iBAAA;MACnD,MAAMD,KAAI,CAACE,WAAW,CAAC;QACrBC,IAAI,EAAE,UAAU;QAChBC,IAAI,EAAE;UACJC,MAAM,EAAE,CAAC;YAAEP,IAAI;YAAEC;UAAM,CAAC;QAC1B;MACF,CAAC,CAAC;IAAC;EACL;EAEMM,MAAMA,CAAA,EAAqB;IAAA,IAAAC,UAAA,GAAAC,SAAA;MAAAC,MAAA;IAAA,OAAAP,iBAAA;MAAA,SAAAQ,IAAA,GAAAH,UAAA,CAAAI,MAAA,EAAjBL,MAAM,OAAAM,KAAA,CAAAF,IAAA,GAAAG,IAAA,MAAAA,IAAA,GAAAH,IAAA,EAAAG,IAAA;QAANP,MAAM,CAAAO,IAAA,IAAAN,UAAA,CAAAM,IAAA;MAAA;MACpB,MAAMJ,MAAI,CAACN,WAAW,CAAC;QACrBC,IAAI,EAAE,UAAU;QAChBC,IAAI,EAAE;UACJC;QACF;MACF,CAAC,CAAC;IAAC;EACL;EAEMQ,IAAIA,CAACC,GAAW,EAAEX,IAAwB,EAAEL,IAAa,EAAE;IAAA,IAAAiB,MAAA;IAAA,OAAAd,iBAAA;MAC/D,MAAMc,MAAI,CAACb,WAAW,CAAC;QACrBC,IAAI,EAAE,UAAU;QAChBC,IAAI,EA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IAAI,CAACC,GAAG,CAAC,CAAC;YAChBe,aAAa,EAAE;cACbF,OAAO,EAAPA,QAAO;cACPG,KAAK,EAAEF;YACT;UACF;QACF,CAAC,CAAC;QAEF,MAAMF,GAAG;MACX;IAAC;EACH;EAEMK,eAAeA,CAACtE,IAAY,EAAE;IAAA,IAAAuE,OAAA;IAAA,OAAApE,iBAAA;MAClC,MAAMoE,OAAI,CAACnE,WAAW,CAAC;QACrBC,IAAI,EAAE,eAAe;QACrBC,IAAI,EAAE;UAAEN;QAAK;MACf,CAAC,CAAC;IAAC;EACL;EAEMwE,aAAaA,CAACxE,IAAY,EAAEC,KAAa,EAAEwE,IAAoB,EAAE;IAAA,IAAAC,OAAA;IAAA,OAAAvE,iBAAA;MACrE,MAAMuE,OAAI,CAACtE,WAAW,CAAC;QACrBC,IAAI,EAAE,eAAe;QACrBC,IAAI,EAAE;UACJoB,UAAU,EAAE,CAAC;YAAE1B,IAAI;YAAEC,KAAK;YAAEwE;UAAK,CAAC;QACpC;MACF,CAAC,CAAC;IAAC;EACL;AAGF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/sdk/types.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/sdk/types.ts"],"sourcesContent":["import type { Label, Link, Parameter, Status, StatusDetails, TestResult, TestResultContainer } from \"../model.js\";\n\ntype RuntimeMessageBase<T extends string> = {\n type: T;\n};\n\nexport type RuntimeMetadataMessage = RuntimeMessageBase<\"metadata\"> & {\n data: {\n labels?: Label[];\n links?: Link[];\n parameters?: Parameter[];\n description?: string;\n descriptionHtml?: string;\n testCaseId?: string;\n historyId?: string;\n displayName?: string;\n };\n};\n\nexport type RuntimeStartStepMessage = RuntimeMessageBase<\"step_start\"> & {\n data: {\n name: string;\n start: number;\n };\n};\n\nexport type RuntimeStepMetadataMessage = RuntimeMessageBase<\"step_metadata\"> & {\n data: {\n name?: string;\n parameters?: Parameter[];\n };\n};\n\nexport type RuntimeStopStepMessage = RuntimeMessageBase<\"step_stop\"> & {\n data: {\n stop: number;\n status: Status;\n statusDetails?: StatusDetails;\n };\n};\n\nexport type RuntimeAttachmentContentMessage = RuntimeMessageBase<\"attachment_content\"> & {\n data: {\n name: string;\n content: string;\n encoding: BufferEncoding;\n contentType: string;\n fileExtension?: string;\n wrapInStep?: boolean;\n timestamp?: number;\n };\n};\n\nexport type RuntimeAttachmentPathMessage = RuntimeMessageBase<\"attachment_path\"> & {\n data: {\n name: string;\n path: string;\n contentType: string;\n fileExtension?: string;\n wrapInStep?: boolean;\n timestamp?: number;\n };\n};\n\nexport type RuntimeMessage =\n | RuntimeMetadataMessage\n | RuntimeStartStepMessage\n | RuntimeStepMetadataMessage\n | RuntimeStopStepMessage\n | RuntimeAttachmentContentMessage\n | RuntimeAttachmentPathMessage;\n\nexport interface TestPlanV1Test {\n id?: string | number;\n selector?: string;\n}\n\nexport interface TestPlanV1 {\n version: \"1.0\";\n tests: TestPlanV1Test[];\n}\n\nexport type EnvironmentInfo = Record<string, string | undefined>;\n\nexport interface Category {\n name?: string;\n description?: string;\n descriptionHtml?: string;\n messageRegex?: string | RegExp;\n traceRegex?: string | RegExp;\n matchedStatuses?: Status[];\n flaky?: boolean;\n}\n\nexport interface ExecutorInfo {\n name?: string;\n type?: string;\n url?: string;\n buildOrder?: number;\n buildName?: string;\n buildUrl?: string;\n reportUrl?: string;\n reportName?: string;\n}\n\nexport interface AllureResults {\n tests: TestResult[];\n groups: TestResultContainer[];\n attachments: Record<string, Buffer | string>;\n envInfo?: EnvironmentInfo;\n categories?: Category[];\n}\n"],"mappings":"","ignoreList":[]}
|
package/dist/types/facade.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type StepContext = {
|
|
|
18
18
|
displayName: (name: string) => void | PromiseLike<void>;
|
|
19
19
|
parameter: (name: string, value: string, mode?: ParameterMode) => void | PromiseLike<void>;
|
|
20
20
|
};
|
|
21
|
-
export declare const step: <T = void>(name: string, body: (context: StepContext) => T | PromiseLike<T>) => PromiseLike<
|
|
21
|
+
export declare const step: <T = void>(name: string, body: (context: StepContext) => T | PromiseLike<T>) => PromiseLike<T>;
|
|
22
22
|
export declare const issue: (url: string, name?: string) => PromiseLike<void>;
|
|
23
23
|
export declare const tms: (url: string, name?: string) => PromiseLike<void>;
|
|
24
24
|
export declare const allureId: (value: string) => PromiseLike<void>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { allureId, attachment, attachmentPath, description, descriptionHtml, displayName, epic, feature, historyId, issue, label, labels, layer, link, links, owner, parameter, parentSuite, severity, step, story, subSuite, suite, tag, tags, testCaseId, tms, } from "./facade.js";
|
|
2
2
|
export type { StepContext } from "./facade.js";
|
|
3
3
|
export type { Attachment, AttachmentOptions, FixtureResult, ImageDiffAttachment, Label, Link, Parameter, ParameterMode, ParameterOptions, StatusDetails, StepResult, TestOrStepResult, TestResult, TestResultContainer, } from "./model.js";
|
|
4
4
|
export { ContentType, LinkType, LabelName, Severity, Stage, Status, StatusByPriority } from "./model.js";
|
package/dist/types/model.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { AllureResults, Category, EnvironmentInfo, ExecutorInfo,
|
|
1
|
+
export type { AllureResults, Category, EnvironmentInfo, ExecutorInfo, RuntimeMessage, RuntimeMetadataMessage, RuntimeAttachmentContentMessage, RuntimeAttachmentPathMessage, RuntimeStartStepMessage, RuntimeStepMetadataMessage, RuntimeStopStepMessage, TestPlanV1Test, TestPlanV1, } from "./types.js";
|
|
2
2
|
export { getStatusFromError, getMessageAndTraceFromError, extractMetadataFromString, isAllStepsEnded, isAnyStepFailed, getUnfinishedStepsMessages, hasStepMessage, isPromise, hasLabel, stripAnsi, } from "./utils.js";
|
|
@@ -6,10 +6,10 @@ export declare class LifecycleState {
|
|
|
6
6
|
stepResults: Map<string, StepResult>;
|
|
7
7
|
fixturesResults: Map<string, FixtureWrapper>;
|
|
8
8
|
getScope: (uuid: string) => TestScope | undefined;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
getWrappedFixtureResult: (uuid: string) => FixtureWrapper | undefined;
|
|
10
|
+
getFixtureResult: (uuid: string) => FixtureResult | undefined;
|
|
11
|
+
getTestResult: (uuid: string) => TestResult | undefined;
|
|
12
|
+
getStepResult: (uuid: string) => StepResult | undefined;
|
|
13
13
|
getExecutionItem: (uuid: string) => FixtureResult | TestResult | StepResult | undefined;
|
|
14
14
|
setTestResult: (uuid: string, result: TestResult) => void;
|
|
15
15
|
deleteTestResult: (uuid: string) => void;
|
|
@@ -1,249 +1,36 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type
|
|
3
|
-
import type { Category, EnvironmentInfo,
|
|
4
|
-
import type { Config, FixtureType, TestScope, Writer } from "./types.js";
|
|
5
|
-
type StartScopeOpts = {
|
|
6
|
-
/**
|
|
7
|
-
* If set to `true`, a manual scope will be created. A manual scope doesn't affect
|
|
8
|
-
* the context. Therefore, tests and fixtures aren't linked to it
|
|
9
|
-
* automatically.
|
|
10
|
-
*
|
|
11
|
-
* Use `linkFixtures`, `updateScope`, or test and fixture start options to fill
|
|
12
|
-
* such scope with tests and fixtures.
|
|
13
|
-
*/
|
|
14
|
-
manual?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* If set to the UUID of an existing scope, the new scope will be created as its
|
|
17
|
-
* sub-scope.
|
|
18
|
-
*
|
|
19
|
-
* Has an effect only if `manual` is `true`.
|
|
20
|
-
*/
|
|
21
|
-
parent?: string;
|
|
22
|
-
};
|
|
23
|
-
type StartFixtureOpts = {
|
|
24
|
-
/**
|
|
25
|
-
* The UUID of the scope that should be associated with the fixture. Defaults to the current
|
|
26
|
-
* scope of the context.
|
|
27
|
-
*
|
|
28
|
-
* If set to `null`, the fixture won't be attached to any scope (except the
|
|
29
|
-
* dedicated one in case `dedicatedScope` is `true`).
|
|
30
|
-
*/
|
|
31
|
-
scope?: string | null;
|
|
32
|
-
/**
|
|
33
|
-
* If set to `true`, an extra scope will be created to hold the fixture result.
|
|
34
|
-
* The scope gets the same UUID as the fixture result and isn't pushed into
|
|
35
|
-
* the context.
|
|
36
|
-
*
|
|
37
|
-
* The scope denoted by the `scope` option will serve as the parent.
|
|
38
|
-
*/
|
|
39
|
-
dedicatedScope?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* The UUIDs of tests affected by the fixture. Those tests will be associated
|
|
42
|
-
* with the fixture's scope.
|
|
43
|
-
*
|
|
44
|
-
* If the `scope` option is set to `null`, implicitly sets `dedicatedScope` to `true`.
|
|
45
|
-
*/
|
|
46
|
-
tests?: string[];
|
|
47
|
-
};
|
|
48
|
-
type StartTestOpts = {
|
|
49
|
-
/**
|
|
50
|
-
* The UUID of a scope the test should be associated with. Defaults to the current one.
|
|
51
|
-
*
|
|
52
|
-
* If set to `null`, the test won't be associated with any scope (except the
|
|
53
|
-
* dedicated one in case the `dedicatedScope` option is `true`).
|
|
54
|
-
*/
|
|
55
|
-
scope?: string | null;
|
|
56
|
-
/**
|
|
57
|
-
* If set to `true`, an extra scope will be created with the same UUID as the
|
|
58
|
-
* test result. The test will be attached to that scope.
|
|
59
|
-
*
|
|
60
|
-
* The scope denoted by the `scope` option will serve as the parent.
|
|
61
|
-
*/
|
|
62
|
-
dedicatedScope?: boolean;
|
|
63
|
-
};
|
|
64
|
-
type StopOpts = {
|
|
65
|
-
/**
|
|
66
|
-
* The test's or fixture's stop time. Defaults to `Date.now()`.
|
|
67
|
-
*/
|
|
68
|
-
stop?: number;
|
|
69
|
-
/**
|
|
70
|
-
* The UUID of a test or fixture to stop.
|
|
71
|
-
*/
|
|
72
|
-
uuid?: string;
|
|
73
|
-
};
|
|
74
|
-
type LinkFixturesOpts = {
|
|
75
|
-
/**
|
|
76
|
-
* The UUIDs of fixtures to associate with the scope or tests.
|
|
77
|
-
*/
|
|
78
|
-
fixtures?: readonly string[];
|
|
79
|
-
/**
|
|
80
|
-
* The UUID of a scope to associate with the fixture or tests.
|
|
81
|
-
*/
|
|
82
|
-
scope?: string;
|
|
83
|
-
/**
|
|
84
|
-
* The UUIDs of tests to associate with the fixture or scope.
|
|
85
|
-
*/
|
|
86
|
-
tests?: readonly string[];
|
|
87
|
-
};
|
|
88
|
-
type ApplyMessagesOpts<T> = {
|
|
89
|
-
fixtureUuid?: string;
|
|
90
|
-
testUuid?: string;
|
|
91
|
-
customHandler?: (message: Exclude<Messages<T>, RuntimeMessage>, fixture?: FixtureResult, test?: TestResult, step?: StepResult) => void | Promise<void>;
|
|
92
|
-
};
|
|
2
|
+
import { type AttachmentOptions, type FixtureResult, type StepResult, type TestResult } from "../../model.js";
|
|
3
|
+
import type { Category, EnvironmentInfo, RuntimeMessage } from "../types.js";
|
|
4
|
+
import type { Config, FixtureType, LinkConfig, TestScope, Writer } from "./types.js";
|
|
93
5
|
export declare class ReporterRuntime {
|
|
6
|
+
#private;
|
|
94
7
|
private readonly state;
|
|
95
8
|
private notifier;
|
|
96
|
-
private
|
|
97
|
-
private contextProvider;
|
|
9
|
+
private stepStack;
|
|
98
10
|
writer: Writer;
|
|
99
11
|
categories?: Category[];
|
|
100
12
|
environmentInfo?: EnvironmentInfo;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
* Removes a scope from the context. Use `writeScope` to emit its fixtures on disk then.
|
|
122
|
-
*
|
|
123
|
-
* If you just want to write the current stop, you may omit the call to this method and
|
|
124
|
-
* call `writeScope` with no uuid.
|
|
125
|
-
*
|
|
126
|
-
* @param uuid The UUID of the scope. If not provided, the current scope will be stopped.
|
|
127
|
-
*
|
|
128
|
-
* @returns The UUID of the scope that has been stopped.
|
|
129
|
-
*/
|
|
130
|
-
stopScope: (uuid?: string) => string | undefined;
|
|
131
|
-
/**
|
|
132
|
-
* Writes all fixtures of a scope on disk.
|
|
133
|
-
*
|
|
134
|
-
* @param uuid The UUID of the scope. If not provided, the current scope will
|
|
135
|
-
* be written and removed from the context. Don't call `stopScope` in that case.
|
|
136
|
-
*/
|
|
137
|
-
writeScope: (uuid?: string) => void;
|
|
138
|
-
/**
|
|
139
|
-
* Creates a new fixture result and puts it in the context as the current one.
|
|
140
|
-
*
|
|
141
|
-
* Use the `scope` parameter to control the fixture's scope. Use `updateScope`
|
|
142
|
-
* or `linkFixtures` to associate fixtures with tests that can't be linked
|
|
143
|
-
* automatically.
|
|
144
|
-
*
|
|
145
|
-
* Use `stopFixture` once the fixture is completed.
|
|
146
|
-
*
|
|
147
|
-
* Use `writeScope` or `writeFixture` to emit fixtures on disk.
|
|
148
|
-
*
|
|
149
|
-
* @param type The type of the fixture. It's either `"before"` or `"after"`.
|
|
150
|
-
* @param fixtureResult The fixture result data.
|
|
151
|
-
* @param scope
|
|
152
|
-
* @param dedicatedScope
|
|
153
|
-
* @param tests
|
|
154
|
-
* @returns The UUID of the new fixture.
|
|
155
|
-
*/
|
|
156
|
-
startFixture: (type: FixtureType, fixtureResult: Partial<FixtureResult>, { scope, dedicatedScope, tests }?: StartFixtureOpts) => `${string}-${string}-${string}-${string}-${string}` | undefined;
|
|
157
|
-
updateFixture: (updateFunc: (result: FixtureResult) => void, uuid?: string) => void;
|
|
158
|
-
/**
|
|
159
|
-
* Stops a fixture and removes it from the context. The fixture result will persist in
|
|
160
|
-
* the storage until it's written on disk with `writeScope` or `writeFixture`.
|
|
161
|
-
*
|
|
162
|
-
* @returns The UUID of the stopped fixture.
|
|
163
|
-
*/
|
|
164
|
-
stopFixture: ({ uuid, stop }?: StopOpts) => string | undefined;
|
|
165
|
-
/**
|
|
166
|
-
* Use to associate fixtures, scopes, and tests with each other.
|
|
167
|
-
*
|
|
168
|
-
* At least two arguments must be provided.
|
|
169
|
-
*/
|
|
170
|
-
linkFixtures: ({ fixtures, scope, tests }: LinkFixturesOpts) => void;
|
|
171
|
-
/**
|
|
172
|
-
* Emits a fixture on disk. Calls `stopFixture` prior to that in case the fixture
|
|
173
|
-
* hasn't been stopped yet. Use this method if you want to manage fixtures manually.
|
|
174
|
-
* Otherwise, use `writeScope`.
|
|
175
|
-
*
|
|
176
|
-
* If called without parameters, implicitly calls `stopFixture`. Make sure you don't call
|
|
177
|
-
* `stopFixture` by yourself in that case.
|
|
178
|
-
*
|
|
179
|
-
* The method has no effect if the fixture isn't associated with at least one test.
|
|
180
|
-
*
|
|
181
|
-
* @param uuid The UUID of the fixture. If not provided, the current fixture will
|
|
182
|
-
* be stopped and emitted. Don't call `stopFixture` in that case.
|
|
183
|
-
*/
|
|
184
|
-
writeFixture: (uuid?: string) => void;
|
|
185
|
-
startTest: (result: Partial<TestResult>, { scope, dedicatedScope }?: StartTestOpts) => string;
|
|
186
|
-
/**
|
|
187
|
-
* Updates test result by uuid
|
|
188
|
-
* @example
|
|
189
|
-
* ```ts
|
|
190
|
-
* runtime.update(uuid, (result) => {
|
|
191
|
-
* // change the result directly, you don't need to return anything
|
|
192
|
-
* result.name = "foo";
|
|
193
|
-
* });
|
|
194
|
-
* ```
|
|
195
|
-
* @param updateFunc - a function that updates the test result; the result is passed as a single argument and should be mutated to apply the changes
|
|
196
|
-
* @param uuid - test result uuid
|
|
197
|
-
*/
|
|
198
|
-
updateTest: (updateFunc: (result: TestResult) => void, uuid?: string) => void;
|
|
199
|
-
stopTest: ({ uuid, stop }?: StopOpts) => void;
|
|
200
|
-
/**
|
|
201
|
-
* Writes a test result on disk and removes it from the storage and the context.
|
|
202
|
-
* @param uuid The UUID of the test. If not set, the current test result is written.
|
|
203
|
-
*/
|
|
204
|
-
writeTest: (uuid?: string) => void;
|
|
205
|
-
/**
|
|
206
|
-
* Starts a new step and pushes it into the context.
|
|
207
|
-
*
|
|
208
|
-
* @param result Data to be put into the step result object.
|
|
209
|
-
* @param uuid The UUID of a test or fixture to attach the step to. If not set, the UUID of the current fixture is used.
|
|
210
|
-
* If no fixture is running, the UUID of the current test is used.
|
|
211
|
-
*
|
|
212
|
-
* @returns The UUID of the step.
|
|
213
|
-
*/
|
|
214
|
-
startStep: (result: Partial<StepResult>, uuid?: string) => `${string}-${string}-${string}-${string}-${string}` | undefined;
|
|
215
|
-
updateStep: (updateFunc: (stepResult: StepResult) => void, uuid?: string) => void;
|
|
216
|
-
stopStep: ({ uuid, stop }?: StopOpts) => void;
|
|
217
|
-
writeAttachment: (attachmentName: string, attachmentContent: Buffer, options: AttachmentOptions, uuid?: string) => void;
|
|
218
|
-
writeAttachmentFromPath: (attachmentName: string, attachmentPath: string, options: AttachmentOptions, uuid?: string) => void;
|
|
13
|
+
linkConfig?: LinkConfig;
|
|
14
|
+
constructor({ writer, listeners, environmentInfo, categories, links }: Config);
|
|
15
|
+
startScope: () => string;
|
|
16
|
+
updateScope: (uuid: string, updateFunc: (scope: TestScope) => void) => void;
|
|
17
|
+
writeScope: (uuid: string) => void;
|
|
18
|
+
startFixture: (scopeUuid: string, type: FixtureType, fixtureResult: Partial<FixtureResult>) => string | undefined;
|
|
19
|
+
updateFixture: (uuid: string, updateFunc: (result: FixtureResult) => void) => void;
|
|
20
|
+
stopFixture: (uuid: string, stop?: number) => void;
|
|
21
|
+
startTest: (result: Partial<TestResult>, scopeUuids?: string[]) => string;
|
|
22
|
+
updateTest: (uuid: string, updateFunc: (result: TestResult) => void) => void;
|
|
23
|
+
stopTest: (uuid: string, stop?: number) => void;
|
|
24
|
+
writeTest: (uuid: string) => void;
|
|
25
|
+
currentStep: (rootUuid: string) => string | undefined;
|
|
26
|
+
startStep: (rootUuid: string, parentStepUuid: string | null | undefined, result: Partial<StepResult>) => string | undefined;
|
|
27
|
+
updateStep: (uuid: string, updateFunc: (stepResult: StepResult) => void) => void;
|
|
28
|
+
stopStep: (uuid: string, stop?: number) => void;
|
|
29
|
+
writeAttachment: (rootUuid: string, parentStepUuid: string | null | undefined, attachmentName: string, attachmentContentOrPath: Buffer | string, options: AttachmentOptions & {
|
|
30
|
+
wrapInStep?: boolean;
|
|
31
|
+
timestamp?: number;
|
|
32
|
+
}) => void;
|
|
219
33
|
writeEnvironmentInfo: () => void;
|
|
220
34
|
writeCategoriesDefinitions: () => void;
|
|
221
|
-
applyRuntimeMessages:
|
|
222
|
-
protected createTestResult(result: Partial<TestResult>): TestResult;
|
|
223
|
-
private handleBuiltInMessage;
|
|
224
|
-
private handleMetadataMessage;
|
|
225
|
-
private handleStepStartMessage;
|
|
226
|
-
private handleStepMetadataMessage;
|
|
227
|
-
private handleStepStopMessage;
|
|
228
|
-
private handleAttachmentContentMessage;
|
|
229
|
-
private handleAttachmentPathMessage;
|
|
230
|
-
private writeAttachmentForItem;
|
|
231
|
-
private startScopeWithUuid;
|
|
232
|
-
private resolveScope;
|
|
233
|
-
private removeScopeFromParent;
|
|
234
|
-
private removeFixtureFromScope;
|
|
235
|
-
private setUpFixtureDedicatedScope;
|
|
236
|
-
private linkScopes;
|
|
237
|
-
private linkFixturesToScope;
|
|
238
|
-
private linkFixtureToScope;
|
|
239
|
-
private stopFixtureObj;
|
|
240
|
-
private writeAllFixturesOfScope;
|
|
241
|
-
private writeFixturesOfScope;
|
|
242
|
-
private writeContainer;
|
|
243
|
-
private addStepToItem;
|
|
244
|
-
private logMissingStepRoot;
|
|
245
|
-
private formatLinks;
|
|
246
|
-
private introduceTestIntoScopes;
|
|
247
|
-
private linkTestsToScope;
|
|
35
|
+
applyRuntimeMessages: (rootUuid: string, messages: RuntimeMessage[]) => void;
|
|
248
36
|
}
|
|
249
|
-
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type * from "./types.js";
|
|
2
|
-
export { ALLURE_METADATA_CONTENT_TYPE, ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE
|
|
2
|
+
export { ALLURE_METADATA_CONTENT_TYPE, ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE } from "./types.js";
|
|
3
3
|
export * from "./utils.js";
|
|
4
4
|
export * from "./testplan.js";
|
|
5
5
|
export * from "./factory.js";
|
|
@@ -1,32 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type { FixtureResult,
|
|
2
|
+
import type { FixtureResult, LinkType, StepResult, TestResult, TestResultContainer } from "../../model.js";
|
|
3
3
|
import type { Category, EnvironmentInfo } from "../types.js";
|
|
4
|
-
import type { AllureContextProvider } from "./context/types.js";
|
|
5
4
|
export declare const ALLURE_METADATA_CONTENT_TYPE = "application/vnd.allure.metadata+json";
|
|
6
|
-
export declare const ALLURE_SKIPPED_BY_TEST_PLAN_LABEL = "allure-skipped-by-test-plan";
|
|
7
5
|
export declare const ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE = "application/vnd.allure.message+json";
|
|
8
|
-
export interface AttachmentMetadata {
|
|
9
|
-
name: string;
|
|
10
|
-
type: string;
|
|
11
|
-
content: string;
|
|
12
|
-
encoding: BufferEncoding;
|
|
13
|
-
}
|
|
14
|
-
export interface StepMetadata extends Omit<StepResult, "attachments" | "steps"> {
|
|
15
|
-
steps: StepMetadata[];
|
|
16
|
-
attachments: AttachmentMetadata[];
|
|
17
|
-
}
|
|
18
|
-
export interface MetadataMessage {
|
|
19
|
-
attachments?: AttachmentMetadata[];
|
|
20
|
-
displayName?: string;
|
|
21
|
-
testCaseId?: string;
|
|
22
|
-
historyId?: string;
|
|
23
|
-
labels?: Label[];
|
|
24
|
-
links?: Link[];
|
|
25
|
-
parameter?: Parameter[];
|
|
26
|
-
description?: string;
|
|
27
|
-
descriptionHtml?: string;
|
|
28
|
-
steps?: StepMetadata[];
|
|
29
|
-
}
|
|
30
6
|
export interface LifecycleListener {
|
|
31
7
|
beforeTestResultStart?: (result: TestResult) => void;
|
|
32
8
|
afterTestResultStart?: (result: TestResult) => void;
|
|
@@ -39,21 +15,20 @@ export interface LifecycleListener {
|
|
|
39
15
|
beforeStepStop?: (result: StepResult) => void;
|
|
40
16
|
afterStepStop?: (result: StepResult) => void;
|
|
41
17
|
}
|
|
42
|
-
export
|
|
43
|
-
|
|
44
|
-
urlTemplate:
|
|
45
|
-
nameTemplate?:
|
|
46
|
-
}
|
|
18
|
+
export type LinkTemplate = string | ((url: string) => string);
|
|
19
|
+
export type LinkTypeOptions = {
|
|
20
|
+
urlTemplate: LinkTemplate;
|
|
21
|
+
nameTemplate?: LinkTemplate;
|
|
22
|
+
};
|
|
23
|
+
export type LinkConfig<TOpts extends LinkTypeOptions = LinkTypeOptions> = Partial<Record<LinkType, TOpts>> & Record<string, TOpts>;
|
|
47
24
|
export type WriterDescriptor = [cls: string, ...args: readonly unknown[]] | string;
|
|
48
25
|
export interface Config {
|
|
49
26
|
readonly resultsDir?: string;
|
|
50
27
|
readonly writer: Writer | WriterDescriptor;
|
|
51
|
-
readonly
|
|
52
|
-
readonly links?: LinkConfig[];
|
|
28
|
+
readonly links?: LinkConfig;
|
|
53
29
|
readonly listeners?: LifecycleListener[];
|
|
54
30
|
readonly environmentInfo?: EnvironmentInfo;
|
|
55
31
|
readonly categories?: Category[];
|
|
56
|
-
readonly contextProvider?: AllureContextProvider;
|
|
57
32
|
}
|
|
58
33
|
export interface Writer {
|
|
59
34
|
writeResult(result: TestResult): void;
|
|
@@ -63,20 +38,14 @@ export interface Writer {
|
|
|
63
38
|
writeEnvironmentInfo(info: EnvironmentInfo): void;
|
|
64
39
|
writeCategoriesDefinitions(categories: Category[]): void;
|
|
65
40
|
}
|
|
66
|
-
export type WellKnownWriters = {
|
|
67
|
-
[key: string]: (new (...args: readonly unknown[]) => Writer) | undefined;
|
|
68
|
-
};
|
|
69
41
|
export type TestScope = {
|
|
70
42
|
uuid: string;
|
|
71
43
|
tests: string[];
|
|
72
|
-
parent?: TestScope;
|
|
73
|
-
subScopes: TestScope[];
|
|
74
44
|
fixtures: FixtureWrapper[];
|
|
75
45
|
};
|
|
76
46
|
export type FixtureType = "before" | "after";
|
|
77
47
|
export type FixtureWrapper = {
|
|
78
48
|
uuid: string;
|
|
79
49
|
value: FixtureResult;
|
|
80
|
-
scope?: TestScope;
|
|
81
50
|
type: FixtureType;
|
|
82
51
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference path="../../../../src/types/properties.d.ts" />
|
|
2
2
|
import properties from "properties";
|
|
3
|
-
import type { Status, StepResult, TestResult } from "../../model.js";
|
|
4
|
-
import type {
|
|
3
|
+
import type { Label, Link, Status, StepResult, TestResult } from "../../model.js";
|
|
4
|
+
import type { LinkConfig, LinkTemplate } from "./types.js";
|
|
5
5
|
export declare const randomUuid: () => `${string}-${string}-${string}-${string}-${string}`;
|
|
6
6
|
export declare const md5: (str: string) => string;
|
|
7
7
|
export declare const getTestResultHistoryId: (result: TestResult) => string;
|
|
@@ -17,4 +17,7 @@ export declare const getSuiteLabels: (suites: readonly string[]) => Label[];
|
|
|
17
17
|
export declare const ensureSuiteLabels: (test: Partial<TestResult>, defaultSuites: readonly string[]) => void;
|
|
18
18
|
export declare const escapeRegExp: (value: string) => string;
|
|
19
19
|
export declare const parseProperties: typeof properties.parse;
|
|
20
|
-
export declare const stringifyProperties:
|
|
20
|
+
export declare const stringifyProperties: (data: any) => string;
|
|
21
|
+
export declare const applyLinkTemplate: (template: LinkTemplate, value: string) => string;
|
|
22
|
+
export declare const formatLink: (templates: LinkConfig, link: Link) => Link;
|
|
23
|
+
export declare const formatLinks: (templates: LinkConfig, links: readonly Link[]) => Link[];
|