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,15 +1,13 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { Label, Link, Parameter, Status, StatusDetails, TestResult, TestResultContainer } from "../model.js";
|
|
3
3
|
type RuntimeMessageBase<T extends string> = {
|
|
4
4
|
type: T;
|
|
5
5
|
};
|
|
6
|
-
type MessageTypes<T> = T extends RuntimeMessageBase<infer K> ? K : never;
|
|
7
6
|
export type RuntimeMetadataMessage = RuntimeMessageBase<"metadata"> & {
|
|
8
7
|
data: {
|
|
9
8
|
labels?: Label[];
|
|
10
9
|
links?: Link[];
|
|
11
10
|
parameters?: Parameter[];
|
|
12
|
-
attachments?: Attachment[];
|
|
13
11
|
description?: string;
|
|
14
12
|
descriptionHtml?: string;
|
|
15
13
|
testCaseId?: string;
|
|
@@ -33,7 +31,6 @@ export type RuntimeStopStepMessage = RuntimeMessageBase<"step_stop"> & {
|
|
|
33
31
|
data: {
|
|
34
32
|
stop: number;
|
|
35
33
|
status: Status;
|
|
36
|
-
stage: Stage;
|
|
37
34
|
statusDetails?: StatusDetails;
|
|
38
35
|
};
|
|
39
36
|
};
|
|
@@ -45,6 +42,7 @@ export type RuntimeAttachmentContentMessage = RuntimeMessageBase<"attachment_con
|
|
|
45
42
|
contentType: string;
|
|
46
43
|
fileExtension?: string;
|
|
47
44
|
wrapInStep?: boolean;
|
|
45
|
+
timestamp?: number;
|
|
48
46
|
};
|
|
49
47
|
};
|
|
50
48
|
export type RuntimeAttachmentPathMessage = RuntimeMessageBase<"attachment_path"> & {
|
|
@@ -54,14 +52,13 @@ export type RuntimeAttachmentPathMessage = RuntimeMessageBase<"attachment_path">
|
|
|
54
52
|
contentType: string;
|
|
55
53
|
fileExtension?: string;
|
|
56
54
|
wrapInStep?: boolean;
|
|
55
|
+
timestamp?: number;
|
|
57
56
|
};
|
|
58
57
|
};
|
|
59
58
|
export type RuntimeMessage = RuntimeMetadataMessage | RuntimeStartStepMessage | RuntimeStepMetadataMessage | RuntimeStopStepMessage | RuntimeAttachmentContentMessage | RuntimeAttachmentPathMessage;
|
|
60
|
-
export type ExtensionMessage<T extends string> = T extends MessageTypes<RuntimeMessage> ? never : RuntimeMessageBase<T>;
|
|
61
|
-
export type Messages<T> = T extends RuntimeMessage | ExtensionMessage<infer _> ? T : never;
|
|
62
59
|
export interface TestPlanV1Test {
|
|
63
|
-
id
|
|
64
|
-
selector
|
|
60
|
+
id?: string | number;
|
|
61
|
+
selector?: string;
|
|
65
62
|
}
|
|
66
63
|
export interface TestPlanV1 {
|
|
67
64
|
version: "1.0";
|
package/package.json
CHANGED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.AllureContextProviderBase = void 0;
|
|
7
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
8
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
9
|
-
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); }
|
|
10
|
-
/* eslint brace-style: 0 */
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Provides the set of methods to access and update the context.
|
|
14
|
-
* Successor classes are responsible for persisting and accessing the context.
|
|
15
|
-
*/
|
|
16
|
-
class AllureContextProviderBase {
|
|
17
|
-
constructor() {
|
|
18
|
-
/**
|
|
19
|
-
* Gets the holder that contains the current value of the context.
|
|
20
|
-
*/
|
|
21
|
-
_defineProperty(this, "load", void 0);
|
|
22
|
-
/**
|
|
23
|
-
* Persist the changes applied to the context since it was last time persisted.
|
|
24
|
-
*/
|
|
25
|
-
_defineProperty(this, "store", void 0);
|
|
26
|
-
_defineProperty(this, "getScope", () => this.getCurrentContext().getScope());
|
|
27
|
-
_defineProperty(this, "getFixture", () => this.getCurrentContext().getFixture());
|
|
28
|
-
_defineProperty(this, "getTest", () => this.getCurrentContext().getTest());
|
|
29
|
-
_defineProperty(this, "getStepRoot", () => {
|
|
30
|
-
var _this$getFixture;
|
|
31
|
-
return (_this$getFixture = this.getFixture()) !== null && _this$getFixture !== void 0 ? _this$getFixture : this.getTest();
|
|
32
|
-
});
|
|
33
|
-
_defineProperty(this, "getStep", root => {
|
|
34
|
-
var resolvedRoot = root !== null && root !== void 0 ? root : this.getStepRoot();
|
|
35
|
-
if (resolvedRoot) {
|
|
36
|
-
return this.getCurrentContext().getStep(resolvedRoot);
|
|
37
|
-
}
|
|
38
|
-
return null;
|
|
39
|
-
});
|
|
40
|
-
_defineProperty(this, "getExecutingItem", root => {
|
|
41
|
-
var resolvedRoot = root !== null && root !== void 0 ? root : this.getStepRoot();
|
|
42
|
-
if (resolvedRoot) {
|
|
43
|
-
var _this$getStep;
|
|
44
|
-
return (_this$getStep = this.getStep(resolvedRoot)) !== null && _this$getStep !== void 0 ? _this$getStep : resolvedRoot;
|
|
45
|
-
}
|
|
46
|
-
return null;
|
|
47
|
-
});
|
|
48
|
-
_defineProperty(this, "addScope", uuid => this.update(b => b.addScope(uuid)));
|
|
49
|
-
_defineProperty(this, "removeScope", uuid => this.update(b => uuid ? b.removeScopeByUuid(uuid) : b.removeScope()));
|
|
50
|
-
_defineProperty(this, "setFixture", uuid => this.update(b => b.setFixture(uuid)));
|
|
51
|
-
_defineProperty(this, "removeFixture", uuid => {
|
|
52
|
-
if (!uuid || this.getFixture() === uuid) {
|
|
53
|
-
this.update(b => b.removeFixture());
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
_defineProperty(this, "setTest", uuid => this.update(b => b.setTest(uuid)));
|
|
57
|
-
_defineProperty(this, "removeTest", uuid => {
|
|
58
|
-
if (!uuid || this.getTest() === uuid) {
|
|
59
|
-
this.update(b => b.removeTest());
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
_defineProperty(this, "addStep", (uuid, root) => {
|
|
63
|
-
var resolvedRoot = root !== null && root !== void 0 ? root : this.getStepRoot();
|
|
64
|
-
if (resolvedRoot) {
|
|
65
|
-
this.update(b => b.addStep(resolvedRoot, uuid));
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
_defineProperty(this, "removeStep", root => {
|
|
69
|
-
var resolvedRoot = root !== null && root !== void 0 ? root : this.getStepRoot();
|
|
70
|
-
if (resolvedRoot) {
|
|
71
|
-
this.update(b => b.removeStep(resolvedRoot));
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
_defineProperty(this, "getCurrentContext", () => this.load().get());
|
|
75
|
-
_defineProperty(this, "update", fn => {
|
|
76
|
-
var holder = this.load();
|
|
77
|
-
fn(holder);
|
|
78
|
-
this.store(holder);
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
exports.AllureContextProviderBase = AllureContextProviderBase;
|
|
83
|
-
//# sourceMappingURL=AllureContextProviderBase.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AllureContextProviderBase.js","names":["AllureContextProviderBase","constructor","_defineProperty","getCurrentContext","getScope","getFixture","getTest","_this$getFixture","root","resolvedRoot","getStepRoot","getStep","_this$getStep","uuid","update","b","addScope","removeScopeByUuid","removeScope","setFixture","removeFixture","setTest","removeTest","addStep","removeStep","load","get","fn","holder","store","exports"],"sources":["../../../../../src/sdk/reporter/context/AllureContextProviderBase.ts"],"sourcesContent":["/* eslint brace-style: 0 */\nimport type { AllureContext, AllureContextHolder, AllureContextProvider } from \"./types.js\";\n\n/**\n * Provides the set of methods to access and update the context.\n * Successor classes are responsible for persisting and accessing the context.\n */\nexport abstract class AllureContextProviderBase<\n TContext extends AllureContext,\n THolder extends AllureContextHolder<TContext>,\n> implements AllureContextProvider\n{\n /**\n * Gets the holder that contains the current value of the context.\n */\n protected abstract load: () => THolder;\n\n /**\n * Persist the changes applied to the context since it was last time persisted.\n */\n protected abstract store: (holder: THolder) => void;\n\n getScope = () => this.getCurrentContext().getScope();\n\n getFixture = () => this.getCurrentContext().getFixture();\n\n getTest = () => this.getCurrentContext().getTest();\n\n getStepRoot = () => this.getFixture() ?? this.getTest();\n\n getStep = (root?: string) => {\n const resolvedRoot = root ?? this.getStepRoot();\n if (resolvedRoot) {\n return this.getCurrentContext().getStep(resolvedRoot);\n }\n return null;\n };\n\n getExecutingItem = (root?: string) => {\n const resolvedRoot = root ?? this.getStepRoot();\n if (resolvedRoot) {\n return this.getStep(resolvedRoot) ?? resolvedRoot;\n }\n return null;\n };\n\n addScope = (uuid: string) => this.update((b) => b.addScope(uuid));\n\n removeScope = (uuid?: string) => this.update((b) => (uuid ? b.removeScopeByUuid(uuid) : b.removeScope()));\n\n setFixture = (uuid: string) => this.update((b) => b.setFixture(uuid));\n\n removeFixture = (uuid?: string) => {\n if (!uuid || this.getFixture() === uuid) {\n this.update((b) => b.removeFixture());\n }\n };\n\n setTest = (uuid: string) => this.update((b) => b.setTest(uuid));\n\n removeTest = (uuid?: string) => {\n if (!uuid || this.getTest() === uuid) {\n this.update((b) => b.removeTest());\n }\n };\n\n addStep = (uuid: string, root?: string) => {\n const resolvedRoot = root ?? this.getStepRoot();\n if (resolvedRoot) {\n this.update((b) => b.addStep(resolvedRoot, uuid));\n }\n };\n\n removeStep = (root?: string) => {\n const resolvedRoot = root ?? this.getStepRoot();\n if (resolvedRoot) {\n this.update((b) => b.removeStep(resolvedRoot));\n }\n };\n\n private getCurrentContext = () => this.load().get();\n\n private update = (fn: (holder: THolder) => void) => {\n const holder = this.load();\n fn(holder);\n this.store(holder);\n };\n}\n"],"mappings":";;;;;;;;;AAAA;;AAGA;AACA;AACA;AACA;AACO,MAAeA,yBAAyB,CAI/C;EAAAC,YAAA;IACE;AACF;AACA;IAFEC,eAAA;IAKA;AACF;AACA;IAFEA,eAAA;IAAAA,eAAA,mBAKW,MAAM,IAAI,CAACC,iBAAiB,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;IAAAF,eAAA,qBAEvC,MAAM,IAAI,CAACC,iBAAiB,CAAC,CAAC,CAACE,UAAU,CAAC,CAAC;IAAAH,eAAA,kBAE9C,MAAM,IAAI,CAACC,iBAAiB,CAAC,CAAC,CAACG,OAAO,CAAC,CAAC;IAAAJ,eAAA,sBAEpC;MAAA,IAAAK,gBAAA;MAAA,QAAAA,gBAAA,GAAM,IAAI,CAACF,UAAU,CAAC,CAAC,cAAAE,gBAAA,cAAAA,gBAAA,GAAI,IAAI,CAACD,OAAO,CAAC,CAAC;IAAA;IAAAJ,eAAA,kBAE5CM,IAAa,IAAK;MAC3B,IAAMC,YAAY,GAAGD,IAAI,aAAJA,IAAI,cA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,qBAEjDW,IAAa,IAAK;MAC9B,IAAI,CAACA,IAAI,IAAI,IAAI,CAACP,OAAO,CAAC,CAAC,KAAKO,IAAI,EAAE;QACpC,IAAI,CAACC,MAAM,CAAEC,CAAC,IAAKA,CAAC,CAACO,UAAU,CAAC,CAAC,CAAC;MACpC;IACF,CAAC;IAAApB,eAAA,kBAES,CAACW,IAAY,EAAEL,IAAa,KAAK;MACzC,IAAMC,YAAY,GAAGD,IAAI,aAAJA,IAAI,cAAJA,IAAI,GAAI,IAAI,CAACE,WAAW,CAAC,CAAC;MAC/C,IAAID,YAAY,EAAE;QAChB,IAAI,CAACK,MAAM,CAAEC,CAAC,IAAKA,CAAC,CAACQ,OAAO,CAACd,YAAY,EAAEI,IAAI,CAAC,CAAC;MACnD;IACF,CAAC;IAAAX,eAAA,qBAEaM,IAAa,IAAK;MAC9B,IAAMC,YAAY,GAAGD,IAAI,aAAJA,IAAI,cAAJA,IAAI,GAAI,IAAI,CAACE,WAAW,CAAC,CAAC;MAC/C,IAAID,YAAY,EAAE;QAChB,IAAI,CAACK,MAAM,CAAEC,CAAC,IAAKA,CAAC,CAACS,UAAU,CAACf,YAAY,CAAC,CAAC;MAChD;IACF,CAAC;IAAAP,eAAA,4BAE2B,MAAM,IAAI,CAACuB,IAAI,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC;IAAAxB,eAAA,iBAEjCyB,EAA6B,IAAK;MAClD,IAAMC,MAAM,GAAG,IAAI,CAACH,IAAI,CAAC,CAAC;MAC1BE,EAAE,CAACC,MAAM,CAAC;MACV,IAAI,CAACC,KAAK,CAACD,MAAM,CAAC;IACpB,CAAC;EAAA;AACH;AAACE,OAAA,CAAA9B,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.StaticContextProvider = exports.MutableAllureContextHolder = exports.MutableAllureContext = void 0;
|
|
7
|
-
var _AllureContextProviderBase = require("./AllureContextProviderBase.js");
|
|
8
|
-
var _StaticContextProvider;
|
|
9
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
10
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
11
|
-
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); }
|
|
12
|
-
/**
|
|
13
|
-
* Allure context that stores its data in mutable class fields.
|
|
14
|
-
* Unsafe from the cuncurrency standpoint.
|
|
15
|
-
*/
|
|
16
|
-
class MutableAllureContext {
|
|
17
|
-
constructor() {
|
|
18
|
-
_defineProperty(this, "scopeStack", []);
|
|
19
|
-
_defineProperty(this, "currentFixture", null);
|
|
20
|
-
_defineProperty(this, "currentTest", null);
|
|
21
|
-
_defineProperty(this, "stepStacks", new Map());
|
|
22
|
-
_defineProperty(this, "getScope", () => MutableAllureContext.last(this.scopeStack));
|
|
23
|
-
_defineProperty(this, "getFixture", () => this.currentFixture);
|
|
24
|
-
_defineProperty(this, "getTest", () => this.currentTest);
|
|
25
|
-
_defineProperty(this, "getStep", scope => MutableAllureContext.last(this.stepStacks.get(scope)));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Implements transitioning between context values by mutating the context
|
|
31
|
-
* object.
|
|
32
|
-
* Unsafe from the cuncurrency standpoint.
|
|
33
|
-
*/
|
|
34
|
-
exports.MutableAllureContext = MutableAllureContext;
|
|
35
|
-
_defineProperty(MutableAllureContext, "last", arr => {
|
|
36
|
-
var _arr;
|
|
37
|
-
return (_arr = arr === null || arr === void 0 ? void 0 : arr[arr.length - 1]) !== null && _arr !== void 0 ? _arr : null;
|
|
38
|
-
});
|
|
39
|
-
class MutableAllureContextHolder {
|
|
40
|
-
constructor() {
|
|
41
|
-
_defineProperty(this, "context", new MutableAllureContext());
|
|
42
|
-
_defineProperty(this, "get", () => this.context);
|
|
43
|
-
_defineProperty(this, "addScope", uuid => {
|
|
44
|
-
this.context.scopeStack.push(uuid);
|
|
45
|
-
});
|
|
46
|
-
_defineProperty(this, "removeScope", () => {
|
|
47
|
-
this.context.scopeStack.pop();
|
|
48
|
-
});
|
|
49
|
-
_defineProperty(this, "removeScopeByUuid", uuid => MutableAllureContextHolder.removeAllOccurrences(this.context.scopeStack, uuid));
|
|
50
|
-
_defineProperty(this, "setFixture", uuid => {
|
|
51
|
-
this.context.currentFixture = uuid;
|
|
52
|
-
});
|
|
53
|
-
_defineProperty(this, "removeFixture", () => {
|
|
54
|
-
this.context.currentFixture = null;
|
|
55
|
-
});
|
|
56
|
-
_defineProperty(this, "setTest", uuid => {
|
|
57
|
-
this.context.currentTest = uuid;
|
|
58
|
-
});
|
|
59
|
-
_defineProperty(this, "removeTest", () => {
|
|
60
|
-
this.context.currentTest = null;
|
|
61
|
-
});
|
|
62
|
-
_defineProperty(this, "addStep", (scope, uuid) => {
|
|
63
|
-
var steps = this.context.stepStacks.get(scope);
|
|
64
|
-
if (steps) {
|
|
65
|
-
steps.push(uuid);
|
|
66
|
-
} else {
|
|
67
|
-
this.context.stepStacks.set(scope, [uuid]);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
_defineProperty(this, "removeStep", scope => {
|
|
71
|
-
var steps = this.context.stepStacks.get(scope);
|
|
72
|
-
if (steps) {
|
|
73
|
-
steps.pop();
|
|
74
|
-
if (!steps.length) {
|
|
75
|
-
this.context.stepStacks.delete(scope);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
_defineProperty(this, "removeStepByUuid", (scope, uuid) => {
|
|
80
|
-
var steps = this.context.stepStacks.get(scope);
|
|
81
|
-
if (steps) {
|
|
82
|
-
MutableAllureContextHolder.removeAllOccurrences(steps, uuid);
|
|
83
|
-
if (!steps.length) {
|
|
84
|
-
this.context.stepStacks.delete(scope);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
static removeAllOccurrences(arr, val) {
|
|
90
|
-
for (var i = arr.indexOf(val); i !== -1; i = arr.indexOf(val, i)) {
|
|
91
|
-
arr.splice(i, 1);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Stores the context in a class field. That's a simple but not async-safe way of
|
|
98
|
-
* manipulating the context.
|
|
99
|
-
*/
|
|
100
|
-
exports.MutableAllureContextHolder = MutableAllureContextHolder;
|
|
101
|
-
class StaticContextProvider extends _AllureContextProviderBase.AllureContextProviderBase {
|
|
102
|
-
constructor(holderSingleton) {
|
|
103
|
-
super();
|
|
104
|
-
this.holderSingleton = holderSingleton;
|
|
105
|
-
_defineProperty(this, "load", () => this.holderSingleton);
|
|
106
|
-
/* The changes are already persisted in the holder singleton. */
|
|
107
|
-
_defineProperty(this, "store", holder => {
|
|
108
|
-
if (!Object.is(holder, this.holderSingleton)) {
|
|
109
|
-
throw new Error("The static context holder can'be replaced with another one.");
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
exports.StaticContextProvider = StaticContextProvider;
|
|
115
|
-
_StaticContextProvider = StaticContextProvider;
|
|
116
|
-
/**
|
|
117
|
-
* Wraps a context holder singleton in the static context provider.
|
|
118
|
-
* @param holderSingleton The singleton to wrap.
|
|
119
|
-
*/
|
|
120
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
121
|
-
_defineProperty(StaticContextProvider, "wrap", holderSingleton => new _StaticContextProvider(holderSingleton));
|
|
122
|
-
//# sourceMappingURL=StaticAllureContextProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StaticAllureContextProvider.js","names":["_AllureContextProviderBase","require","_StaticContextProvider","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","MutableAllureContext","constructor","Map","last","scopeStack","currentFixture","currentTest","scope","stepStacks","get","exports","arr","_arr","length","MutableAllureContextHolder","context","uuid","push","pop","removeAllOccurrences","steps","set","delete","val","indexOf","splice","StaticContextProvider","AllureContextProviderBase","holderSingleton","holder","is","Error"],"sources":["../../../../../src/sdk/reporter/context/StaticAllureContextProvider.ts"],"sourcesContent":["import { AllureContextProviderBase } from \"./AllureContextProviderBase.js\";\nimport type { AllureContext, AllureContextHolder } from \"./types.js\";\n\n/**\n * Allure context that stores its data in mutable class fields.\n * Unsafe from the cuncurrency standpoint.\n */\nexport class MutableAllureContext implements AllureContext {\n readonly scopeStack: string[] = [];\n currentFixture: string | null = null;\n currentTest: string | null = null;\n readonly stepStacks: Map<string, string[]> = new Map();\n\n getScope = () => MutableAllureContext.last(this.scopeStack);\n getFixture = () => this.currentFixture;\n getTest = () => this.currentTest;\n getStep = (scope: string) => MutableAllureContext.last(this.stepStacks.get(scope));\n\n private static last = <T>(arr: T[] | undefined) => arr?.[arr.length - 1] ?? null;\n}\n\n/**\n * Implements transitioning between context values by mutating the context\n * object.\n * Unsafe from the cuncurrency standpoint.\n */\nexport class MutableAllureContextHolder implements AllureContextHolder<MutableAllureContext> {\n private readonly context: MutableAllureContext = new MutableAllureContext();\n\n get = () => this.context;\n\n addScope = (uuid: string) => {\n this.context.scopeStack.push(uuid);\n };\n\n removeScope = () => {\n this.context.scopeStack.pop();\n };\n\n removeScopeByUuid = (uuid: string) => MutableAllureContextHolder.removeAllOccurrences(this.context.scopeStack, uuid);\n\n setFixture = (uuid: string) => {\n this.context.currentFixture = uuid;\n };\n\n removeFixture = () => {\n this.context.currentFixture = null;\n };\n\n setTest = (uuid: string) => {\n this.context.currentTest = uuid;\n };\n\n removeTest = () => {\n this.context.currentTest = null;\n };\n\n addStep = (scope: string, uuid: string) => {\n const steps = this.context.stepStacks.get(scope);\n if (steps) {\n steps.push(uuid);\n } else {\n this.context.stepStacks.set(scope, [uuid]);\n }\n };\n\n removeStep = (scope: string) => {\n const steps = this.context.stepStacks.get(scope);\n if (steps) {\n steps.pop();\n if (!steps.length) {\n this.context.stepStacks.delete(scope);\n }\n }\n };\n\n removeStepByUuid = (scope: string, uuid: string) => {\n const steps = this.context.stepStacks.get(scope);\n if (steps) {\n MutableAllureContextHolder.removeAllOccurrences(steps, uuid);\n if (!steps.length) {\n this.context.stepStacks.delete(scope);\n }\n }\n };\n\n private static removeAllOccurrences<T>(arr: T[], val: T) {\n for (let i = arr.indexOf(val); i !== -1; i = arr.indexOf(val, i)) {\n arr.splice(i, 1);\n }\n }\n}\n\n/**\n * Stores the context in a class field. That's a simple but not async-safe way of\n * manipulating the context.\n */\nexport class StaticContextProvider<\n TContext extends AllureContext,\n THolder extends AllureContextHolder<TContext>,\n> extends AllureContextProviderBase<TContext, THolder> {\n constructor(private readonly holderSingleton: THolder) {\n super();\n }\n\n protected override load = () => this.holderSingleton;\n\n /* The changes are already persisted in the holder singleton. */\n protected store = (holder: THolder) => {\n if (!Object.is(holder, this.holderSingleton)) {\n throw new Error(\"The static context holder can'be replaced with another one.\");\n }\n };\n\n /**\n * Wraps a context holder singleton in the static context provider.\n * @param holderSingleton The singleton to wrap.\n */\n // eslint-disable-next-line @typescript-eslint/no-shadow\n static wrap = <TContext extends AllureContext, THolder extends AllureContextHolder<TContext>>(\n holderSingleton: THolder,\n ) => new StaticContextProvider<TContext, THolder>(holderSingleton);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,0BAAA,GAAAC,OAAA;AAA2E,IAAAC,sBAAA;AAAA,SAAAC,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GA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WA,CAAkB2B,eAAwB,EAAE;IACrD,KAAK,CAAC,CAAC;IAAC,KADmBA,eAAwB,GAAxBA,eAAwB;IAAA/C,eAAA,eAI3B,MAAM,IAAI,CAAC+C,eAAe;IAEpD;IAAA/C,eAAA,gBACmBgD,MAAe,IAAK;MACrC,IAAI,CAAC3C,MAAM,CAAC4C,EAAE,CAACD,MAAM,EAAE,IAAI,CAACD,eAAe,CAAC,EAAE;QAC5C,MAAM,IAAIG,KAAK,CAAC,6DAA6D,CAAC;MAChF;IACF,CAAC;EATD;AAmBF;AAACrB,OAAA,CAAAgB,qBAAA,GAAAA,qBAAA;AAAA9C,sBAAA,GAzBY8C,qBAAqB;AAiBhC;AACF;AACA;AACA;AACE;AAAA7C,eAAA,CArBW6C,qBAAqB,UAuB9BE,eAAwB,IACrB,IAAIF,sBAAqB,CAAoBE,eAAe,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/sdk/reporter/context/types.ts"],"sourcesContent":["/**\n * Represents a snapshot of the Allure state at some particular moment during the run.\n */\nexport type AllureContext = {\n getScope: () => string | null;\n getFixture: () => string | null;\n getTest: () => string | null;\n getStep: (root: string) => string | null;\n};\n\n/**\n * Implements the transitions from one snapshot to another.\n */\nexport type AllureContextHolder<TContext extends AllureContext> = {\n get: () => TContext;\n\n addScope: (uuid: string) => void;\n removeScope: () => void;\n removeScopeByUuid: (uuid: string) => void;\n\n setFixture: (uuid: string) => void;\n removeFixture: () => void;\n\n setTest: (uuid: string) => void;\n removeTest: () => void;\n\n addStep: (root: string, uuid: string) => void;\n removeStep: (root: string) => void;\n};\n\n/**\n * Provides the set of methods to access and update the context.\n */\nexport type AllureContextProvider = {\n getScope: () => string | null;\n getFixture: () => string | null;\n getTest: () => string | null;\n getStepRoot: () => string | null;\n getStep: (root?: string) => string | null;\n getExecutingItem: (root?: string) => string | null;\n addScope: (uuid: string) => void;\n removeScope: (uuid?: string) => void;\n setFixture: (uuid: string) => void;\n removeFixture: (uuid?: string) => void;\n setTest: (uuid: string) => void;\n removeTest: (uuid?: string) => void;\n addStep: (uuid: string, root?: string) => void;\n removeStep: (root?: string, uuid?: string) => void;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
-
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); }
|
|
4
|
-
/* eslint brace-style: 0 */
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Provides the set of methods to access and update the context.
|
|
8
|
-
* Successor classes are responsible for persisting and accessing the context.
|
|
9
|
-
*/
|
|
10
|
-
export class AllureContextProviderBase {
|
|
11
|
-
constructor() {
|
|
12
|
-
/**
|
|
13
|
-
* Gets the holder that contains the current value of the context.
|
|
14
|
-
*/
|
|
15
|
-
_defineProperty(this, "load", void 0);
|
|
16
|
-
/**
|
|
17
|
-
* Persist the changes applied to the context since it was last time persisted.
|
|
18
|
-
*/
|
|
19
|
-
_defineProperty(this, "store", void 0);
|
|
20
|
-
_defineProperty(this, "getScope", () => this.getCurrentContext().getScope());
|
|
21
|
-
_defineProperty(this, "getFixture", () => this.getCurrentContext().getFixture());
|
|
22
|
-
_defineProperty(this, "getTest", () => this.getCurrentContext().getTest());
|
|
23
|
-
_defineProperty(this, "getStepRoot", () => {
|
|
24
|
-
var _this$getFixture;
|
|
25
|
-
return (_this$getFixture = this.getFixture()) !== null && _this$getFixture !== void 0 ? _this$getFixture : this.getTest();
|
|
26
|
-
});
|
|
27
|
-
_defineProperty(this, "getStep", root => {
|
|
28
|
-
var resolvedRoot = root !== null && root !== void 0 ? root : this.getStepRoot();
|
|
29
|
-
if (resolvedRoot) {
|
|
30
|
-
return this.getCurrentContext().getStep(resolvedRoot);
|
|
31
|
-
}
|
|
32
|
-
return null;
|
|
33
|
-
});
|
|
34
|
-
_defineProperty(this, "getExecutingItem", root => {
|
|
35
|
-
var resolvedRoot = root !== null && root !== void 0 ? root : this.getStepRoot();
|
|
36
|
-
if (resolvedRoot) {
|
|
37
|
-
var _this$getStep;
|
|
38
|
-
return (_this$getStep = this.getStep(resolvedRoot)) !== null && _this$getStep !== void 0 ? _this$getStep : resolvedRoot;
|
|
39
|
-
}
|
|
40
|
-
return null;
|
|
41
|
-
});
|
|
42
|
-
_defineProperty(this, "addScope", uuid => this.update(b => b.addScope(uuid)));
|
|
43
|
-
_defineProperty(this, "removeScope", uuid => this.update(b => uuid ? b.removeScopeByUuid(uuid) : b.removeScope()));
|
|
44
|
-
_defineProperty(this, "setFixture", uuid => this.update(b => b.setFixture(uuid)));
|
|
45
|
-
_defineProperty(this, "removeFixture", uuid => {
|
|
46
|
-
if (!uuid || this.getFixture() === uuid) {
|
|
47
|
-
this.update(b => b.removeFixture());
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
_defineProperty(this, "setTest", uuid => this.update(b => b.setTest(uuid)));
|
|
51
|
-
_defineProperty(this, "removeTest", uuid => {
|
|
52
|
-
if (!uuid || this.getTest() === uuid) {
|
|
53
|
-
this.update(b => b.removeTest());
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
_defineProperty(this, "addStep", (uuid, root) => {
|
|
57
|
-
var resolvedRoot = root !== null && root !== void 0 ? root : this.getStepRoot();
|
|
58
|
-
if (resolvedRoot) {
|
|
59
|
-
this.update(b => b.addStep(resolvedRoot, uuid));
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
_defineProperty(this, "removeStep", root => {
|
|
63
|
-
var resolvedRoot = root !== null && root !== void 0 ? root : this.getStepRoot();
|
|
64
|
-
if (resolvedRoot) {
|
|
65
|
-
this.update(b => b.removeStep(resolvedRoot));
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
_defineProperty(this, "getCurrentContext", () => this.load().get());
|
|
69
|
-
_defineProperty(this, "update", fn => {
|
|
70
|
-
var holder = this.load();
|
|
71
|
-
fn(holder);
|
|
72
|
-
this.store(holder);
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=AllureContextProviderBase.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AllureContextProviderBase.js","names":["AllureContextProviderBase","constructor","_defineProperty","getCurrentContext","getScope","getFixture","getTest","_this$getFixture","root","resolvedRoot","getStepRoot","getStep","_this$getStep","uuid","update","b","addScope","removeScopeByUuid","removeScope","setFixture","removeFixture","setTest","removeTest","addStep","removeStep","load","get","fn","holder","store"],"sources":["../../../../../src/sdk/reporter/context/AllureContextProviderBase.ts"],"sourcesContent":["/* eslint brace-style: 0 */\nimport type { AllureContext, AllureContextHolder, AllureContextProvider } from \"./types.js\";\n\n/**\n * Provides the set of methods to access and update the context.\n * Successor classes are responsible for persisting and accessing the context.\n */\nexport abstract class AllureContextProviderBase<\n TContext extends AllureContext,\n THolder extends AllureContextHolder<TContext>,\n> implements AllureContextProvider\n{\n /**\n * Gets the holder that contains the current value of the context.\n */\n protected abstract load: () => THolder;\n\n /**\n * Persist the changes applied to the context since it was last time persisted.\n */\n protected abstract store: (holder: THolder) => void;\n\n getScope = () => this.getCurrentContext().getScope();\n\n getFixture = () => this.getCurrentContext().getFixture();\n\n getTest = () => this.getCurrentContext().getTest();\n\n getStepRoot = () => this.getFixture() ?? this.getTest();\n\n getStep = (root?: string) => {\n const resolvedRoot = root ?? this.getStepRoot();\n if (resolvedRoot) {\n return this.getCurrentContext().getStep(resolvedRoot);\n }\n return null;\n };\n\n getExecutingItem = (root?: string) => {\n const resolvedRoot = root ?? this.getStepRoot();\n if (resolvedRoot) {\n return this.getStep(resolvedRoot) ?? resolvedRoot;\n }\n return null;\n };\n\n addScope = (uuid: string) => this.update((b) => b.addScope(uuid));\n\n removeScope = (uuid?: string) => this.update((b) => (uuid ? b.removeScopeByUuid(uuid) : b.removeScope()));\n\n setFixture = (uuid: string) => this.update((b) => b.setFixture(uuid));\n\n removeFixture = (uuid?: string) => {\n if (!uuid || this.getFixture() === uuid) {\n this.update((b) => b.removeFixture());\n }\n };\n\n setTest = (uuid: string) => this.update((b) => b.setTest(uuid));\n\n removeTest = (uuid?: string) => {\n if (!uuid || this.getTest() === uuid) {\n this.update((b) => b.removeTest());\n }\n };\n\n addStep = (uuid: string, root?: string) => {\n const resolvedRoot = root ?? this.getStepRoot();\n if (resolvedRoot) {\n this.update((b) => b.addStep(resolvedRoot, uuid));\n }\n };\n\n removeStep = (root?: string) => {\n const resolvedRoot = root ?? this.getStepRoot();\n if (resolvedRoot) {\n this.update((b) => b.removeStep(resolvedRoot));\n }\n };\n\n private getCurrentContext = () => this.load().get();\n\n private update = (fn: (holder: THolder) => void) => {\n const holder = this.load();\n fn(holder);\n this.store(holder);\n };\n}\n"],"mappings":";;;AAAA;;AAGA;AACA;AACA;AACA;AACA,OAAO,MAAeA,yBAAyB,CAI/C;EAAAC,YAAA;IACE;AACF;AACA;IAFEC,eAAA;IAKA;AACF;AACA;IAFEA,eAAA;IAAAA,eAAA,mBAKW,MAAM,IAAI,CAACC,iBAAiB,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;IAAAF,eAAA,qBAEvC,MAAM,IAAI,CAACC,iBAAiB,CAAC,CAAC,CAACE,UAAU,CAAC,CAAC;IAAAH,eAAA,kBAE9C,MAAM,IAAI,CAACC,iBAAiB,CAAC,CAAC,CAACG,OAAO,CAAC,CAAC;IAAAJ,eAAA,sBAEpC;MAAA,IAAAK,gBAAA;MAAA,QAAAA,gBAAA,GAAM,IAAI,C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 @@
|
|
|
1
|
-
var _StaticContextProvider;
|
|
2
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
3
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
4
|
-
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); }
|
|
5
|
-
import { AllureContextProviderBase } from "./AllureContextProviderBase.js";
|
|
6
|
-
/**
|
|
7
|
-
* Allure context that stores its data in mutable class fields.
|
|
8
|
-
* Unsafe from the cuncurrency standpoint.
|
|
9
|
-
*/
|
|
10
|
-
export class MutableAllureContext {
|
|
11
|
-
constructor() {
|
|
12
|
-
_defineProperty(this, "scopeStack", []);
|
|
13
|
-
_defineProperty(this, "currentFixture", null);
|
|
14
|
-
_defineProperty(this, "currentTest", null);
|
|
15
|
-
_defineProperty(this, "stepStacks", new Map());
|
|
16
|
-
_defineProperty(this, "getScope", () => MutableAllureContext.last(this.scopeStack));
|
|
17
|
-
_defineProperty(this, "getFixture", () => this.currentFixture);
|
|
18
|
-
_defineProperty(this, "getTest", () => this.currentTest);
|
|
19
|
-
_defineProperty(this, "getStep", scope => MutableAllureContext.last(this.stepStacks.get(scope)));
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Implements transitioning between context values by mutating the context
|
|
25
|
-
* object.
|
|
26
|
-
* Unsafe from the cuncurrency standpoint.
|
|
27
|
-
*/
|
|
28
|
-
_defineProperty(MutableAllureContext, "last", arr => {
|
|
29
|
-
var _arr;
|
|
30
|
-
return (_arr = arr === null || arr === void 0 ? void 0 : arr[arr.length - 1]) !== null && _arr !== void 0 ? _arr : null;
|
|
31
|
-
});
|
|
32
|
-
export class MutableAllureContextHolder {
|
|
33
|
-
constructor() {
|
|
34
|
-
_defineProperty(this, "context", new MutableAllureContext());
|
|
35
|
-
_defineProperty(this, "get", () => this.context);
|
|
36
|
-
_defineProperty(this, "addScope", uuid => {
|
|
37
|
-
this.context.scopeStack.push(uuid);
|
|
38
|
-
});
|
|
39
|
-
_defineProperty(this, "removeScope", () => {
|
|
40
|
-
this.context.scopeStack.pop();
|
|
41
|
-
});
|
|
42
|
-
_defineProperty(this, "removeScopeByUuid", uuid => MutableAllureContextHolder.removeAllOccurrences(this.context.scopeStack, uuid));
|
|
43
|
-
_defineProperty(this, "setFixture", uuid => {
|
|
44
|
-
this.context.currentFixture = uuid;
|
|
45
|
-
});
|
|
46
|
-
_defineProperty(this, "removeFixture", () => {
|
|
47
|
-
this.context.currentFixture = null;
|
|
48
|
-
});
|
|
49
|
-
_defineProperty(this, "setTest", uuid => {
|
|
50
|
-
this.context.currentTest = uuid;
|
|
51
|
-
});
|
|
52
|
-
_defineProperty(this, "removeTest", () => {
|
|
53
|
-
this.context.currentTest = null;
|
|
54
|
-
});
|
|
55
|
-
_defineProperty(this, "addStep", (scope, uuid) => {
|
|
56
|
-
var steps = this.context.stepStacks.get(scope);
|
|
57
|
-
if (steps) {
|
|
58
|
-
steps.push(uuid);
|
|
59
|
-
} else {
|
|
60
|
-
this.context.stepStacks.set(scope, [uuid]);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
_defineProperty(this, "removeStep", scope => {
|
|
64
|
-
var steps = this.context.stepStacks.get(scope);
|
|
65
|
-
if (steps) {
|
|
66
|
-
steps.pop();
|
|
67
|
-
if (!steps.length) {
|
|
68
|
-
this.context.stepStacks.delete(scope);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
_defineProperty(this, "removeStepByUuid", (scope, uuid) => {
|
|
73
|
-
var steps = this.context.stepStacks.get(scope);
|
|
74
|
-
if (steps) {
|
|
75
|
-
MutableAllureContextHolder.removeAllOccurrences(steps, uuid);
|
|
76
|
-
if (!steps.length) {
|
|
77
|
-
this.context.stepStacks.delete(scope);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
static removeAllOccurrences(arr, val) {
|
|
83
|
-
for (var i = arr.indexOf(val); i !== -1; i = arr.indexOf(val, i)) {
|
|
84
|
-
arr.splice(i, 1);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Stores the context in a class field. That's a simple but not async-safe way of
|
|
91
|
-
* manipulating the context.
|
|
92
|
-
*/
|
|
93
|
-
export class StaticContextProvider extends AllureContextProviderBase {
|
|
94
|
-
constructor(holderSingleton) {
|
|
95
|
-
super();
|
|
96
|
-
this.holderSingleton = holderSingleton;
|
|
97
|
-
_defineProperty(this, "load", () => this.holderSingleton);
|
|
98
|
-
/* The changes are already persisted in the holder singleton. */
|
|
99
|
-
_defineProperty(this, "store", holder => {
|
|
100
|
-
if (!Object.is(holder, this.holderSingleton)) {
|
|
101
|
-
throw new Error("The static context holder can'be replaced with another one.");
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
_StaticContextProvider = StaticContextProvider;
|
|
107
|
-
/**
|
|
108
|
-
* Wraps a context holder singleton in the static context provider.
|
|
109
|
-
* @param holderSingleton The singleton to wrap.
|
|
110
|
-
*/
|
|
111
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
112
|
-
_defineProperty(StaticContextProvider, "wrap", holderSingleton => new _StaticContextProvider(holderSingleton));
|
|
113
|
-
//# sourceMappingURL=StaticAllureContextProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StaticAllureContextProvider.js","names":["AllureContextProviderBase","MutableAllureContext","constructor","_defineProperty","Map","last","scopeStack","currentFixture","currentTest","scope","stepStacks","get","arr","_arr","length","MutableAllureContextHolder","context","uuid","push","pop","removeAllOccurrences","steps","set","delete","val","i","indexOf","splice","StaticContextProvider","holderSingleton","holder","Object","is","Error","_StaticContextProvider"],"sources":["../../../../../src/sdk/reporter/context/StaticAllureContextProvider.ts"],"sourcesContent":["import { AllureContextProviderBase } from \"./AllureContextProviderBase.js\";\nimport type { AllureContext, AllureContextHolder } from \"./types.js\";\n\n/**\n * Allure context that stores its data in mutable class fields.\n * Unsafe from the cuncurrency standpoint.\n */\nexport class MutableAllureContext implements AllureContext {\n readonly scopeStack: string[] = [];\n currentFixture: string | null = null;\n currentTest: string | null = null;\n readonly stepStacks: Map<string, string[]> = new Map();\n\n getScope = () => MutableAllureContext.last(this.scopeStack);\n getFixture = () => this.currentFixture;\n getTest = () => this.currentTest;\n getStep = (scope: string) => MutableAllureContext.last(this.stepStacks.get(scope));\n\n private static last = <T>(arr: T[] | undefined) => arr?.[arr.length - 1] ?? null;\n}\n\n/**\n * Implements transitioning between context values by mutating the context\n * object.\n * Unsafe from the cuncurrency standpoint.\n */\nexport class MutableAllureContextHolder implements AllureContextHolder<MutableAllureContext> {\n private readonly context: MutableAllureContext = new MutableAllureContext();\n\n get = () => this.context;\n\n addScope = (uuid: string) => {\n this.context.scopeStack.push(uuid);\n };\n\n removeScope = () => {\n this.context.scopeStack.pop();\n };\n\n removeScopeByUuid = (uuid: string) => MutableAllureContextHolder.removeAllOccurrences(this.context.scopeStack, uuid);\n\n setFixture = (uuid: string) => {\n this.context.currentFixture = uuid;\n };\n\n removeFixture = () => {\n this.context.currentFixture = null;\n };\n\n setTest = (uuid: string) => {\n this.context.currentTest = uuid;\n };\n\n removeTest = () => {\n this.context.currentTest = null;\n };\n\n addStep = (scope: string, uuid: string) => {\n const steps = this.context.stepStacks.get(scope);\n if (steps) {\n steps.push(uuid);\n } else {\n this.context.stepStacks.set(scope, [uuid]);\n }\n };\n\n removeStep = (scope: string) => {\n const steps = this.context.stepStacks.get(scope);\n if (steps) {\n steps.pop();\n if (!steps.length) {\n this.context.stepStacks.delete(scope);\n }\n }\n };\n\n removeStepByUuid = (scope: string, uuid: string) => {\n const steps = this.context.stepStacks.get(scope);\n if (steps) {\n MutableAllureContextHolder.removeAllOccurrences(steps, uuid);\n if (!steps.length) {\n this.context.stepStacks.delete(scope);\n }\n }\n };\n\n private static removeAllOccurrences<T>(arr: T[], val: T) {\n for (let i = arr.indexOf(val); i !== -1; i = arr.indexOf(val, i)) {\n arr.splice(i, 1);\n }\n }\n}\n\n/**\n * Stores the context in a class field. That's a simple but not async-safe way of\n * manipulating the context.\n */\nexport class StaticContextProvider<\n TContext extends AllureContext,\n THolder extends AllureContextHolder<TContext>,\n> extends AllureContextProviderBase<TContext, THolder> {\n constructor(private readonly holderSingleton: THolder) {\n super();\n }\n\n protected override load = () => this.holderSingleton;\n\n /* The changes are already persisted in the holder singleton. */\n protected store = (holder: THolder) => {\n if (!Object.is(holder, this.holderSingleton)) {\n throw new Error(\"The static context holder can'be replaced with another one.\");\n }\n };\n\n /**\n * Wraps a context holder singleton in the static context provider.\n * @param holderSingleton The singleton to wrap.\n */\n // eslint-disable-next-line @typescript-eslint/no-shadow\n static wrap = <TContext extends AllureContext, THolder extends AllureContextHolder<TContext>>(\n holderSingleton: THolder,\n ) => new StaticContextProvider<TContext, THolder>(holderSingleton);\n}\n"],"mappings":";;;;AAAA,SAASA,yBAAyB,QAAQ,gCAAgC;AAG1E;AACA;AACA;AACA;AACA,OAAO,MAAMC,oBAAoB,CAA0B;EAAAC,YAAA;IAAAC,eAAA,qBACzB,EAAE;IAAAA,eAAA,yBACF,IAAI;IAAAA,eAAA,sBACP,IAAI;IAAAA,eAAA,qBACY,IAAIC,GAAG,CAAC,CAAC;IAAAD,eAAA,mBAE3C,MAAMF,oBAAoB,CAACI,IAAI,CAAC,IAAI,CAACC,UAAU,CAAC;IAAAH,eAAA,qBAC9C,MAAM,IAAI,CAACI,cAAc;IAAAJ,eAAA,kBAC5B,MAAM,IAAI,CA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AACe,MAAM,CAACF,CAAC,EAAE,CAAC,CAAC;IAClB;EACF;AACF;;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMG,qBAAqB,SAGxB5B,yBAAyB,CAAoB;EACrDE,WAAWA,CAAkB2B,eAAwB,EAAE;IACrD,KAAK,CAAC,CAAC;IAAC,KADmBA,eAAwB,GAAxBA,eAAwB;IAAA1B,eAAA,eAI3B,MAAM,IAAI,CAAC0B,eAAe;IAEpD;IAAA1B,eAAA,gBACmB2B,MAAe,IAAK;MACrC,IAAI,CAACC,MAAM,CAACC,EAAE,CAACF,MAAM,EAAE,IAAI,CAACD,eAAe,CAAC,EAAE;QAC5C,MAAM,IAAII,KAAK,CAAC,6DAA6D,CAAC;MAChF;IACF,CAAC;EATD;AAmBF;AAACC,sBAAA,GAzBYN,qBAAqB;AAiBhC;AACF;AACA;AACA;AACE;AAAAzB,eAAA,CArBWyB,qBAAqB,UAuB9BC,eAAwB,IACrB,IAAID,sBAAqB,CAAoBC,eAAe,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/sdk/reporter/context/types.ts"],"sourcesContent":["/**\n * Represents a snapshot of the Allure state at some particular moment during the run.\n */\nexport type AllureContext = {\n getScope: () => string | null;\n getFixture: () => string | null;\n getTest: () => string | null;\n getStep: (root: string) => string | null;\n};\n\n/**\n * Implements the transitions from one snapshot to another.\n */\nexport type AllureContextHolder<TContext extends AllureContext> = {\n get: () => TContext;\n\n addScope: (uuid: string) => void;\n removeScope: () => void;\n removeScopeByUuid: (uuid: string) => void;\n\n setFixture: (uuid: string) => void;\n removeFixture: () => void;\n\n setTest: (uuid: string) => void;\n removeTest: () => void;\n\n addStep: (root: string, uuid: string) => void;\n removeStep: (root: string) => void;\n};\n\n/**\n * Provides the set of methods to access and update the context.\n */\nexport type AllureContextProvider = {\n getScope: () => string | null;\n getFixture: () => string | null;\n getTest: () => string | null;\n getStepRoot: () => string | null;\n getStep: (root?: string) => string | null;\n getExecutingItem: (root?: string) => string | null;\n addScope: (uuid: string) => void;\n removeScope: (uuid?: string) => void;\n setFixture: (uuid: string) => void;\n removeFixture: (uuid?: string) => void;\n setTest: (uuid: string) => void;\n removeTest: (uuid?: string) => void;\n addStep: (uuid: string, root?: string) => void;\n removeStep: (root?: string, uuid?: string) => void;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { AllureContext, AllureContextHolder, AllureContextProvider } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Provides the set of methods to access and update the context.
|
|
4
|
-
* Successor classes are responsible for persisting and accessing the context.
|
|
5
|
-
*/
|
|
6
|
-
export declare abstract class AllureContextProviderBase<TContext extends AllureContext, THolder extends AllureContextHolder<TContext>> implements AllureContextProvider {
|
|
7
|
-
/**
|
|
8
|
-
* Gets the holder that contains the current value of the context.
|
|
9
|
-
*/
|
|
10
|
-
protected abstract load: () => THolder;
|
|
11
|
-
/**
|
|
12
|
-
* Persist the changes applied to the context since it was last time persisted.
|
|
13
|
-
*/
|
|
14
|
-
protected abstract store: (holder: THolder) => void;
|
|
15
|
-
getScope: () => string | null;
|
|
16
|
-
getFixture: () => string | null;
|
|
17
|
-
getTest: () => string | null;
|
|
18
|
-
getStepRoot: () => string | null;
|
|
19
|
-
getStep: (root?: string) => string | null;
|
|
20
|
-
getExecutingItem: (root?: string) => string | null;
|
|
21
|
-
addScope: (uuid: string) => void;
|
|
22
|
-
removeScope: (uuid?: string) => void;
|
|
23
|
-
setFixture: (uuid: string) => void;
|
|
24
|
-
removeFixture: (uuid?: string) => void;
|
|
25
|
-
setTest: (uuid: string) => void;
|
|
26
|
-
removeTest: (uuid?: string) => void;
|
|
27
|
-
addStep: (uuid: string, root?: string) => void;
|
|
28
|
-
removeStep: (root?: string) => void;
|
|
29
|
-
private getCurrentContext;
|
|
30
|
-
private update;
|
|
31
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { AllureContextProviderBase } from "./AllureContextProviderBase.js";
|
|
2
|
-
import type { AllureContext, AllureContextHolder } from "./types.js";
|
|
3
|
-
/**
|
|
4
|
-
* Allure context that stores its data in mutable class fields.
|
|
5
|
-
* Unsafe from the cuncurrency standpoint.
|
|
6
|
-
*/
|
|
7
|
-
export declare class MutableAllureContext implements AllureContext {
|
|
8
|
-
readonly scopeStack: string[];
|
|
9
|
-
currentFixture: string | null;
|
|
10
|
-
currentTest: string | null;
|
|
11
|
-
readonly stepStacks: Map<string, string[]>;
|
|
12
|
-
getScope: () => string | null;
|
|
13
|
-
getFixture: () => string | null;
|
|
14
|
-
getTest: () => string | null;
|
|
15
|
-
getStep: (scope: string) => string | null;
|
|
16
|
-
private static last;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Implements transitioning between context values by mutating the context
|
|
20
|
-
* object.
|
|
21
|
-
* Unsafe from the cuncurrency standpoint.
|
|
22
|
-
*/
|
|
23
|
-
export declare class MutableAllureContextHolder implements AllureContextHolder<MutableAllureContext> {
|
|
24
|
-
private readonly context;
|
|
25
|
-
get: () => MutableAllureContext;
|
|
26
|
-
addScope: (uuid: string) => void;
|
|
27
|
-
removeScope: () => void;
|
|
28
|
-
removeScopeByUuid: (uuid: string) => void;
|
|
29
|
-
setFixture: (uuid: string) => void;
|
|
30
|
-
removeFixture: () => void;
|
|
31
|
-
setTest: (uuid: string) => void;
|
|
32
|
-
removeTest: () => void;
|
|
33
|
-
addStep: (scope: string, uuid: string) => void;
|
|
34
|
-
removeStep: (scope: string) => void;
|
|
35
|
-
removeStepByUuid: (scope: string, uuid: string) => void;
|
|
36
|
-
private static removeAllOccurrences;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Stores the context in a class field. That's a simple but not async-safe way of
|
|
40
|
-
* manipulating the context.
|
|
41
|
-
*/
|
|
42
|
-
export declare class StaticContextProvider<TContext extends AllureContext, THolder extends AllureContextHolder<TContext>> extends AllureContextProviderBase<TContext, THolder> {
|
|
43
|
-
private readonly holderSingleton;
|
|
44
|
-
constructor(holderSingleton: THolder);
|
|
45
|
-
protected load: () => THolder;
|
|
46
|
-
protected store: (holder: THolder) => void;
|
|
47
|
-
/**
|
|
48
|
-
* Wraps a context holder singleton in the static context provider.
|
|
49
|
-
* @param holderSingleton The singleton to wrap.
|
|
50
|
-
*/
|
|
51
|
-
static wrap: <TContext_1 extends AllureContext, THolder_1 extends AllureContextHolder<TContext_1>>(holderSingleton: THolder_1) => StaticContextProvider<TContext_1, THolder_1>;
|
|
52
|
-
}
|