@fluidframework/test-utils 2.90.0 → 2.91.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +2 -0
- package/dist/eventAndErrorLogger.d.ts +51 -0
- package/dist/eventAndErrorLogger.d.ts.map +1 -0
- package/dist/eventAndErrorLogger.js +116 -0
- package/dist/eventAndErrorLogger.js.map +1 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/testObjectProvider.d.ts +4 -46
- package/dist/testObjectProvider.d.ts.map +1 -1
- package/dist/testObjectProvider.js +6 -113
- package/dist/testObjectProvider.js.map +1 -1
- package/dist/timeoutUtils.d.ts.map +1 -1
- package/dist/timeoutUtils.js +2 -0
- package/dist/timeoutUtils.js.map +1 -1
- package/lib/eventAndErrorLogger.d.ts +51 -0
- package/lib/eventAndErrorLogger.d.ts.map +1 -0
- package/lib/eventAndErrorLogger.js +111 -0
- package/lib/eventAndErrorLogger.js.map +1 -0
- package/lib/index.d.ts +7 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +11 -2
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/testObjectProvider.d.ts +4 -46
- package/lib/testObjectProvider.d.ts.map +1 -1
- package/lib/testObjectProvider.js +1 -106
- package/lib/testObjectProvider.js.map +1 -1
- package/lib/timeoutUtils.d.ts.map +1 -1
- package/lib/timeoutUtils.js +2 -0
- package/lib/timeoutUtils.js.map +1 -1
- package/package.json +25 -25
- package/src/eventAndErrorLogger.ts +164 -0
- package/src/index.ts +22 -8
- package/src/packageVersion.ts +1 -1
- package/src/testObjectProvider.ts +5 -155
- package/src/timeoutUtils.ts +8 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
This package contains utilities for writing end-to-end tests in Fluid Framework. It helps in the creation of a simple hosting application to test Fluid objects and other functionalities of the system.
|
|
4
4
|
|
|
5
|
+
Internal note: Currently, it also has a load side-effect when loaded under mocha where `@fluid-internal/mocha-test-setup` is used. The side-effect will attempt to inject an error 15ms before a test case would otherwise timeout.
|
|
6
|
+
|
|
5
7
|
<!-- AUTO-GENERATED-CONTENT:START (LIBRARY_README_HEADER:devDependency=TRUE) -->
|
|
6
8
|
|
|
7
9
|
<!-- prettier-ignore-start -->
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import type { ITelemetryBaseEvent, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
6
|
+
import type { ITelemetryGenericEventExt } from "@fluidframework/telemetry-utils/internal";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export interface IEventAndErrorTrackingLogger {
|
|
9
|
+
registerExpectedEvent: (...orderedExpectedEvents: ITelemetryGenericEventExt[]) => void;
|
|
10
|
+
reportAndClearTrackedEvents: () => {
|
|
11
|
+
expectedNotFound: {
|
|
12
|
+
index: number;
|
|
13
|
+
event: ITelemetryGenericEventExt;
|
|
14
|
+
}[];
|
|
15
|
+
unexpectedErrors: ITelemetryBaseEvent[];
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* This class tracks events. It allows specifying expected events, which will be looked for in order.
|
|
20
|
+
* It also tracks all unexpected errors.
|
|
21
|
+
* At any point you call reportAndClearTrackedEvents which will provide all unexpected errors, and
|
|
22
|
+
* any expected events that have not occurred.
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
export declare class EventAndErrorTrackingLogger implements ITelemetryBaseLogger, IEventAndErrorTrackingLogger {
|
|
26
|
+
private readonly baseLogger?;
|
|
27
|
+
/**
|
|
28
|
+
* Even if these error events are logged, tests should still be allowed to pass
|
|
29
|
+
* Additionally, if downgrade is true, then log as generic (e.g. to avoid polluting the e2e test logs)
|
|
30
|
+
*/
|
|
31
|
+
private readonly allowedErrors;
|
|
32
|
+
constructor(baseLogger?: ITelemetryBaseLogger | undefined);
|
|
33
|
+
private readonly expectedEvents;
|
|
34
|
+
private readonly unexpectedErrors;
|
|
35
|
+
registerExpectedEvent(...orderedExpectedEvents: ITelemetryGenericEventExt[]): void;
|
|
36
|
+
send(event: ITelemetryBaseEvent): void;
|
|
37
|
+
reportAndClearTrackedEvents(): {
|
|
38
|
+
expectedNotFound: {
|
|
39
|
+
index: number;
|
|
40
|
+
event: ITelemetryGenericEventExt;
|
|
41
|
+
}[];
|
|
42
|
+
unexpectedErrors: ITelemetryBaseEvent[];
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Retrieves unexpected errors from a logger and returns them as an exception.
|
|
47
|
+
*
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
export declare function getUnexpectedLogErrorException(logger: IEventAndErrorTrackingLogger | undefined, prefix?: string): Error | undefined;
|
|
51
|
+
//# sourceMappingURL=eventAndErrorLogger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventAndErrorLogger.d.ts","sourceRoot":"","sources":["../src/eventAndErrorLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,mBAAmB,EACnB,oBAAoB,EACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAI1F,gBAAgB;AAChB,MAAM,WAAW,4BAA4B;IAC5C,qBAAqB,EAAE,CAAC,GAAG,qBAAqB,EAAE,yBAAyB,EAAE,KAAK,IAAI,CAAC;IACvF,2BAA2B,EAAE,MAAM;QAClC,gBAAgB,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,yBAAyB,CAAA;SAAE,EAAE,CAAC;QACxE,gBAAgB,EAAE,mBAAmB,EAAE,CAAC;KACxC,CAAC;CACF;AAED;;;;;;GAMG;AACH,qBAAa,2BACZ,YAAW,oBAAoB,EAAE,4BAA4B;IAgBjD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;IAdxC;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,aAAa,CAQ5B;gBAE2B,UAAU,CAAC,kCAAsB;IAE9D,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA6D;IAC5F,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA6B;IAEvD,qBAAqB,CAAC,GAAG,qBAAqB,EAAE,yBAAyB,EAAE,GAAG,IAAI;IAczF,IAAI,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI;IAwC/B,2BAA2B,IAAI;QACrC,gBAAgB,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,yBAAyB,CAAA;SAAE,EAAE,CAAC;QACxE,gBAAgB,EAAE,mBAAmB,EAAE,CAAC;KACxC;CAQD;AAgBD;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC7C,MAAM,EAAE,4BAA4B,GAAG,SAAS,EAChD,MAAM,CAAC,EAAE,MAAM,GACb,KAAK,GAAG,SAAS,CAuBnB"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.getUnexpectedLogErrorException = exports.EventAndErrorTrackingLogger = void 0;
|
|
8
|
+
const nonEmptyArrayType_js_1 = require("./nonEmptyArrayType.js");
|
|
9
|
+
/**
|
|
10
|
+
* This class tracks events. It allows specifying expected events, which will be looked for in order.
|
|
11
|
+
* It also tracks all unexpected errors.
|
|
12
|
+
* At any point you call reportAndClearTrackedEvents which will provide all unexpected errors, and
|
|
13
|
+
* any expected events that have not occurred.
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
class EventAndErrorTrackingLogger {
|
|
17
|
+
constructor(baseLogger) {
|
|
18
|
+
this.baseLogger = baseLogger;
|
|
19
|
+
/**
|
|
20
|
+
* Even if these error events are logged, tests should still be allowed to pass
|
|
21
|
+
* Additionally, if downgrade is true, then log as generic (e.g. to avoid polluting the e2e test logs)
|
|
22
|
+
*/
|
|
23
|
+
this.allowedErrors = [
|
|
24
|
+
// This log was removed in current version as unnecessary, but it's still present in previous versions
|
|
25
|
+
{
|
|
26
|
+
eventName: "fluid:telemetry:Container:NoRealStorageInDetachedContainer",
|
|
27
|
+
downgrade: true,
|
|
28
|
+
},
|
|
29
|
+
// This log's category changes depending on the op latency. test results shouldn't be affected but if we see lots we'd like an alert from the logs.
|
|
30
|
+
{ eventName: "fluid:telemetry:OpRoundtripTime" },
|
|
31
|
+
];
|
|
32
|
+
this.expectedEvents = [];
|
|
33
|
+
this.unexpectedErrors = [];
|
|
34
|
+
}
|
|
35
|
+
registerExpectedEvent(...orderedExpectedEvents) {
|
|
36
|
+
if (this.expectedEvents.length !== 0) {
|
|
37
|
+
// we don't have to error here. just no reason not to. given the events must be
|
|
38
|
+
// ordered it could be tricky to figure out problems around multiple registrations.
|
|
39
|
+
throw new Error("Expected events already registered.\n" +
|
|
40
|
+
"Call reportAndClearTrackedEvents to clear them before registering more");
|
|
41
|
+
}
|
|
42
|
+
this.expectedEvents.push(...orderedExpectedEvents.map((event, index) => ({ index, event })));
|
|
43
|
+
}
|
|
44
|
+
send(event) {
|
|
45
|
+
if ((0, nonEmptyArrayType_js_1.isNonEmptyArray)(this.expectedEvents)) {
|
|
46
|
+
const ee = this.expectedEvents[0].event;
|
|
47
|
+
if (ee.eventName === event.eventName) {
|
|
48
|
+
let matches = true;
|
|
49
|
+
for (const key of Object.keys(ee)) {
|
|
50
|
+
if (ee[key] !== event[key]) {
|
|
51
|
+
matches = false;
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (matches) {
|
|
56
|
+
// we found an expected event
|
|
57
|
+
// so remove it from the list of expected events
|
|
58
|
+
// and if it is an error, change it to generic
|
|
59
|
+
// this helps keep our telemetry clear of
|
|
60
|
+
// expected errors.
|
|
61
|
+
this.expectedEvents.shift();
|
|
62
|
+
if (event.category === "error") {
|
|
63
|
+
event.category = "generic";
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (event.category === "error") {
|
|
69
|
+
// Check to see if this error is allowed and if its category should be downgraded
|
|
70
|
+
const allowedError = this.allowedErrors.find(({ eventName }) => eventName === event.eventName);
|
|
71
|
+
if (allowedError === undefined) {
|
|
72
|
+
this.unexpectedErrors.push(event);
|
|
73
|
+
}
|
|
74
|
+
else if (allowedError.downgrade) {
|
|
75
|
+
event.category = "generic";
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
this.baseLogger?.send(event);
|
|
79
|
+
}
|
|
80
|
+
reportAndClearTrackedEvents() {
|
|
81
|
+
const expectedNotFound = this.expectedEvents.splice(0, this.expectedEvents.length);
|
|
82
|
+
const unexpectedErrors = this.unexpectedErrors.splice(0, this.unexpectedErrors.length);
|
|
83
|
+
return {
|
|
84
|
+
expectedNotFound,
|
|
85
|
+
unexpectedErrors,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.EventAndErrorTrackingLogger = EventAndErrorTrackingLogger;
|
|
90
|
+
/** Summarize the event with just the primary properties, for succinct output in case of test failure */
|
|
91
|
+
const primaryEventProps = ({ category, eventName, error, errorType, }) => ({
|
|
92
|
+
category,
|
|
93
|
+
eventName,
|
|
94
|
+
error,
|
|
95
|
+
errorType,
|
|
96
|
+
["..."]: "*** Additional properties not shown, see full log for details ***",
|
|
97
|
+
});
|
|
98
|
+
/**
|
|
99
|
+
* Retrieves unexpected errors from a logger and returns them as an exception.
|
|
100
|
+
*
|
|
101
|
+
* @internal
|
|
102
|
+
*/
|
|
103
|
+
function getUnexpectedLogErrorException(logger, prefix) {
|
|
104
|
+
if (logger === undefined) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const results = logger.reportAndClearTrackedEvents();
|
|
108
|
+
if (results.unexpectedErrors.length > 0) {
|
|
109
|
+
return new Error(`${prefix ?? ""}Unexpected Errors in Logs:\n${JSON.stringify(results.unexpectedErrors.map(primaryEventProps), undefined, 2)}`);
|
|
110
|
+
}
|
|
111
|
+
if (results.expectedNotFound.length > 0) {
|
|
112
|
+
return new Error(`${prefix ?? ""}Expected Events not found:\n${JSON.stringify(results.expectedNotFound, undefined, 2)}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
exports.getUnexpectedLogErrorException = getUnexpectedLogErrorException;
|
|
116
|
+
//# sourceMappingURL=eventAndErrorLogger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventAndErrorLogger.js","sourceRoot":"","sources":["../src/eventAndErrorLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,iEAAyD;AAWzD;;;;;;GAMG;AACH,MAAa,2BAA2B;IAiBvC,YAA6B,UAAiC;QAAjC,eAAU,GAAV,UAAU,CAAuB;QAd9D;;;WAGG;QACc,kBAAa,GAA8C;YAC3E,sGAAsG;YACtG;gBACC,SAAS,EAAE,4DAA4D;gBACvE,SAAS,EAAE,IAAI;aACf;YACD,mJAAmJ;YACnJ,EAAE,SAAS,EAAE,iCAAiC,EAAE;SAChD,CAAC;QAIe,mBAAc,GAA0D,EAAE,CAAC;QAC3E,qBAAgB,GAA0B,EAAE,CAAC;IAHG,CAAC;IAK3D,qBAAqB,CAAC,GAAG,qB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gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzC,OAAO,IAAI,KAAK,CACf,GAAG,MAAM,IAAI,EAAE,+BAA+B,IAAI,CAAC,SAAS,CAC3D,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAC/C,SAAS,EACT,CAAC,CACD,EAAE,CACH,CAAC;IACH,CAAC;IACD,IAAI,OAAO,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzC,OAAO,IAAI,KAAK,CACf,GAAG,MAAM,IAAI,EAAE,+BAA+B,IAAI,CAAC,SAAS,CAC3D,OAAO,CAAC,gBAAgB,EACxB,SAAS,EACT,CAAC,CACD,EAAE,CACH,CAAC;IACH,CAAC;AACF,CAAC;AA1BD,wEA0BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tITelemetryBaseEvent,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport type { ITelemetryGenericEventExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { isNonEmptyArray } from \"./nonEmptyArrayType.js\";\n\n/** @internal */\nexport interface IEventAndErrorTrackingLogger {\n\tregisterExpectedEvent: (...orderedExpectedEvents: ITelemetryGenericEventExt[]) => void;\n\treportAndClearTrackedEvents: () => {\n\t\texpectedNotFound: { index: number; event: ITelemetryGenericEventExt }[];\n\t\tunexpectedErrors: ITelemetryBaseEvent[];\n\t};\n}\n\n/**\n * This class tracks events. It allows specifying expected events, which will be looked for in order.\n * It also tracks all unexpected errors.\n * At any point you call reportAndClearTrackedEvents which will provide all unexpected errors, and\n * any expected events that have not occurred.\n * @internal\n */\nexport class EventAndErrorTrackingLogger\n\timplements ITelemetryBaseLogger, IEventAndErrorTrackingLogger\n{\n\t/**\n\t * Even if these error events are logged, tests should still be allowed to pass\n\t * Additionally, if downgrade is true, then log as generic (e.g. to avoid polluting the e2e test logs)\n\t */\n\tprivate readonly allowedErrors: { eventName: string; downgrade?: true }[] = [\n\t\t// This log was removed in current version as unnecessary, but it's still present in previous versions\n\t\t{\n\t\t\teventName: \"fluid:telemetry:Container:NoRealStorageInDetachedContainer\",\n\t\t\tdowngrade: true,\n\t\t},\n\t\t// This log's category changes depending on the op latency. test results shouldn't be affected but if we see lots we'd like an alert from the logs.\n\t\t{ eventName: \"fluid:telemetry:OpRoundtripTime\" },\n\t];\n\n\tconstructor(private readonly baseLogger?: ITelemetryBaseLogger) {}\n\n\tprivate readonly expectedEvents: { index: number; event: ITelemetryGenericEventExt }[] = [];\n\tprivate readonly unexpectedErrors: ITelemetryBaseEvent[] = [];\n\n\tpublic registerExpectedEvent(...orderedExpectedEvents: ITelemetryGenericEventExt[]): void {\n\t\tif (this.expectedEvents.length !== 0) {\n\t\t\t// we don't have to error here. just no reason not to. given the events must be\n\t\t\t// ordered it could be tricky to figure out problems around multiple registrations.\n\t\t\tthrow new Error(\n\t\t\t\t\"Expected events already registered.\\n\" +\n\t\t\t\t\t\"Call reportAndClearTrackedEvents to clear them before registering more\",\n\t\t\t);\n\t\t}\n\t\tthis.expectedEvents.push(\n\t\t\t...orderedExpectedEvents.map((event, index) => ({ index, event })),\n\t\t);\n\t}\n\n\tsend(event: ITelemetryBaseEvent): void {\n\t\tif (isNonEmptyArray(this.expectedEvents)) {\n\t\t\tconst ee = this.expectedEvents[0].event;\n\t\t\tif (ee.eventName === event.eventName) {\n\t\t\t\tlet matches = true;\n\t\t\t\tfor (const key of Object.keys(ee)) {\n\t\t\t\t\tif (ee[key] !== event[key]) {\n\t\t\t\t\t\tmatches = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (matches) {\n\t\t\t\t\t// we found an expected event\n\t\t\t\t\t// so remove it from the list of expected events\n\t\t\t\t\t// and if it is an error, change it to generic\n\t\t\t\t\t// this helps keep our telemetry clear of\n\t\t\t\t\t// expected errors.\n\t\t\t\t\tthis.expectedEvents.shift();\n\t\t\t\t\tif (event.category === \"error\") {\n\t\t\t\t\t\tevent.category = \"generic\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (event.category === \"error\") {\n\t\t\t// Check to see if this error is allowed and if its category should be downgraded\n\t\t\tconst allowedError = this.allowedErrors.find(\n\t\t\t\t({ eventName }) => eventName === event.eventName,\n\t\t\t);\n\n\t\t\tif (allowedError === undefined) {\n\t\t\t\tthis.unexpectedErrors.push(event);\n\t\t\t} else if (allowedError.downgrade) {\n\t\t\t\tevent.category = \"generic\";\n\t\t\t}\n\t\t}\n\n\t\tthis.baseLogger?.send(event);\n\t}\n\n\tpublic reportAndClearTrackedEvents(): {\n\t\texpectedNotFound: { index: number; event: ITelemetryGenericEventExt }[];\n\t\tunexpectedErrors: ITelemetryBaseEvent[];\n\t} {\n\t\tconst expectedNotFound = this.expectedEvents.splice(0, this.expectedEvents.length);\n\t\tconst unexpectedErrors = this.unexpectedErrors.splice(0, this.unexpectedErrors.length);\n\t\treturn {\n\t\t\texpectedNotFound,\n\t\t\tunexpectedErrors,\n\t\t};\n\t}\n}\n\n/** Summarize the event with just the primary properties, for succinct output in case of test failure */\nconst primaryEventProps = ({\n\tcategory,\n\teventName,\n\terror,\n\terrorType,\n}: ITelemetryBaseEvent): Partial<ITelemetryBaseEvent> => ({\n\tcategory,\n\teventName,\n\terror,\n\terrorType,\n\t[\"...\"]: \"*** Additional properties not shown, see full log for details ***\",\n});\n\n/**\n * Retrieves unexpected errors from a logger and returns them as an exception.\n *\n * @internal\n */\nexport function getUnexpectedLogErrorException(\n\tlogger: IEventAndErrorTrackingLogger | undefined,\n\tprefix?: string,\n): Error | undefined {\n\tif (logger === undefined) {\n\t\treturn;\n\t}\n\tconst results = logger.reportAndClearTrackedEvents();\n\tif (results.unexpectedErrors.length > 0) {\n\t\treturn new Error(\n\t\t\t`${prefix ?? \"\"}Unexpected Errors in Logs:\\n${JSON.stringify(\n\t\t\t\tresults.unexpectedErrors.map(primaryEventProps),\n\t\t\t\tundefined,\n\t\t\t\t2,\n\t\t\t)}`,\n\t\t);\n\t}\n\tif (results.expectedNotFound.length > 0) {\n\t\treturn new Error(\n\t\t\t`${prefix ?? \"\"}Expected Events not found:\\n${JSON.stringify(\n\t\t\t\tresults.expectedNotFound,\n\t\t\t\tundefined,\n\t\t\t\t2,\n\t\t\t)}`,\n\t\t);\n\t}\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,16 +2,20 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
export type { IEventAndErrorTrackingLogger } from "./eventAndErrorLogger.js";
|
|
6
|
+
export { EventAndErrorTrackingLogger, getUnexpectedLogErrorException, } from "./eventAndErrorLogger.js";
|
|
5
7
|
export { IProvideTestFluidObject, ITestFluidObject } from "./interfaces.js";
|
|
6
|
-
export { LoaderContainerTracker } from "./loaderContainerTracker.js";
|
|
7
8
|
export { fluidEntryPoint, LocalCodeLoader, SupportedExportInterfaces, Factory, createDataStoreFactory, } from "./localCodeLoader.js";
|
|
8
9
|
export { createAndAttachContainer, createLoader, createLoaderProps, createAndAttachContainerUsingProps, } from "./localLoader.js";
|
|
9
10
|
export { retryWithEventualValue } from "./retry.js";
|
|
10
11
|
export { createTestConfigProvider, ITestConfigProvider } from "./TestConfigs.js";
|
|
11
12
|
export { createTestContainerRuntimeFactory, TestContainerRuntimeFactory, } from "./testContainerRuntimeFactory.js";
|
|
12
13
|
export { ChannelFactoryRegistry, TestFluidObject, TestFluidObjectFactory, TestDataObjectKind, } from "./testFluidObject.js";
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
14
|
+
export { LoaderContainerTracker } from "./loaderContainerTracker.js";
|
|
15
|
+
export type { IDocumentIdStrategy, IOpProcessingController, ITestContainerConfig, ITestObjectProvider, } from "./testObjectProvider.js";
|
|
16
|
+
export { createDocumentId, DataObjectFactoryType, TestObjectProvider, TestObjectProviderWithVersionedLoad, } from "./testObjectProvider.js";
|
|
17
|
+
export type { SummaryInfo } from "./TestSummaryUtils.js";
|
|
18
|
+
export { createSummarizer, createSummarizerCore, createSummarizerFromFactory, summarizeNow, } from "./TestSummaryUtils.js";
|
|
15
19
|
export { timeoutAwait, timeoutPromise, type TimeoutDurationOption, type TimeoutWithError, type TimeoutWithValue, } from "./timeoutUtils.js";
|
|
16
20
|
export { toIDeltaManagerFull, waitForContainerConnection, getContainerEntryPointBackCompat, getDataStoreEntryPointBackCompat, } from "./containerUtils.js";
|
|
17
21
|
export { type ContainerRuntimeFactoryWithDefaultDataStoreConstructor, type ContainerRuntimeFactoryWithDefaultDataStoreProps, createContainerRuntimeFactoryWithDefaultDataStore, } from "./testContainerRuntimeFactoryWithDefaultDataStore.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EACN,2BAA2B,EAC3B,8BAA8B,GAC9B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EACN,eAAe,EACf,eAAe,EACf,yBAAyB,EACzB,OAAO,EACP,sBAAsB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,wBAAwB,EACxB,YAAY,EACZ,iBAAiB,EACjB,kCAAkC,GAClC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EACN,iCAAiC,EACjC,2BAA2B,GAC3B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACN,sBAAsB,EACtB,eAAe,EACf,sBAAsB,EACtB,kBAAkB,GAClB,MAAM,sBAAsB,CAAC;AAS9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,YAAY,EACX,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAClB,mCAAmC,GACnC,MAAM,yBAAyB,CAAC;AACjC,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACN,gBAAgB,EAChB,oBAAoB,EACpB,2BAA2B,EAC3B,YAAY,GACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,YAAY,EACZ,cAAc,EACd,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,mBAAmB,EACnB,0BAA0B,EAC1B,gCAAgC,EAChC,gCAAgC,GAChC,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACN,KAAK,sDAAsD,EAC3D,KAAK,gDAAgD,EACrD,iDAAiD,GACjD,MAAM,sDAAsD,CAAC;AAE9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.TestFluidObjectInternal = exports.createContainerRuntimeFactoryWithDefaultDataStore = exports.getDataStoreEntryPointBackCompat = exports.getContainerEntryPointBackCompat = exports.waitForContainerConnection = exports.toIDeltaManagerFull = exports.timeoutPromise = exports.timeoutAwait = exports.summarizeNow = exports.createSummarizerFromFactory = exports.createSummarizerCore = exports.createSummarizer = exports.TestObjectProviderWithVersionedLoad = exports.TestObjectProvider = exports.
|
|
8
|
-
var
|
|
9
|
-
Object.defineProperty(exports, "
|
|
7
|
+
exports.TestFluidObjectInternal = exports.createContainerRuntimeFactoryWithDefaultDataStore = exports.getDataStoreEntryPointBackCompat = exports.getContainerEntryPointBackCompat = exports.waitForContainerConnection = exports.toIDeltaManagerFull = exports.timeoutPromise = exports.timeoutAwait = exports.summarizeNow = exports.createSummarizerFromFactory = exports.createSummarizerCore = exports.createSummarizer = exports.TestObjectProviderWithVersionedLoad = exports.TestObjectProvider = exports.DataObjectFactoryType = exports.createDocumentId = exports.LoaderContainerTracker = exports.TestFluidObjectFactory = exports.TestFluidObject = exports.TestContainerRuntimeFactory = exports.createTestContainerRuntimeFactory = exports.createTestConfigProvider = exports.retryWithEventualValue = exports.createAndAttachContainerUsingProps = exports.createLoaderProps = exports.createLoader = exports.createAndAttachContainer = exports.createDataStoreFactory = exports.LocalCodeLoader = exports.getUnexpectedLogErrorException = exports.EventAndErrorTrackingLogger = void 0;
|
|
8
|
+
var eventAndErrorLogger_js_1 = require("./eventAndErrorLogger.js");
|
|
9
|
+
Object.defineProperty(exports, "EventAndErrorTrackingLogger", { enumerable: true, get: function () { return eventAndErrorLogger_js_1.EventAndErrorTrackingLogger; } });
|
|
10
|
+
Object.defineProperty(exports, "getUnexpectedLogErrorException", { enumerable: true, get: function () { return eventAndErrorLogger_js_1.getUnexpectedLogErrorException; } });
|
|
10
11
|
var localCodeLoader_js_1 = require("./localCodeLoader.js");
|
|
11
12
|
Object.defineProperty(exports, "LocalCodeLoader", { enumerable: true, get: function () { return localCodeLoader_js_1.LocalCodeLoader; } });
|
|
12
13
|
Object.defineProperty(exports, "createDataStoreFactory", { enumerable: true, get: function () { return localCodeLoader_js_1.createDataStoreFactory; } });
|
|
@@ -25,11 +26,18 @@ Object.defineProperty(exports, "TestContainerRuntimeFactory", { enumerable: true
|
|
|
25
26
|
var testFluidObject_js_1 = require("./testFluidObject.js");
|
|
26
27
|
Object.defineProperty(exports, "TestFluidObject", { enumerable: true, get: function () { return testFluidObject_js_1.TestFluidObject; } });
|
|
27
28
|
Object.defineProperty(exports, "TestFluidObjectFactory", { enumerable: true, get: function () { return testFluidObject_js_1.TestFluidObjectFactory; } });
|
|
29
|
+
// #region Exports with load side-effect
|
|
30
|
+
// The below runtime (not "type") exports transitively or directly import
|
|
31
|
+
// timeoutUtils.ts, which always executes on import and may patch Mocha's timeout
|
|
32
|
+
// handling. That patching only takes effect when consumers use
|
|
33
|
+
// @fluid-internal/mocha-test-setup that sets globalThis.getMochaModule.
|
|
34
|
+
// @fluid-internal/mocha-test-setup is pervasive in our tests and thus patch
|
|
35
|
+
// is usually in effect (when this package is used).
|
|
36
|
+
var loaderContainerTracker_js_1 = require("./loaderContainerTracker.js");
|
|
37
|
+
Object.defineProperty(exports, "LoaderContainerTracker", { enumerable: true, get: function () { return loaderContainerTracker_js_1.LoaderContainerTracker; } });
|
|
28
38
|
var testObjectProvider_js_1 = require("./testObjectProvider.js");
|
|
29
39
|
Object.defineProperty(exports, "createDocumentId", { enumerable: true, get: function () { return testObjectProvider_js_1.createDocumentId; } });
|
|
30
40
|
Object.defineProperty(exports, "DataObjectFactoryType", { enumerable: true, get: function () { return testObjectProvider_js_1.DataObjectFactoryType; } });
|
|
31
|
-
Object.defineProperty(exports, "EventAndErrorTrackingLogger", { enumerable: true, get: function () { return testObjectProvider_js_1.EventAndErrorTrackingLogger; } });
|
|
32
|
-
Object.defineProperty(exports, "getUnexpectedLogErrorException", { enumerable: true, get: function () { return testObjectProvider_js_1.getUnexpectedLogErrorException; } });
|
|
33
41
|
Object.defineProperty(exports, "TestObjectProvider", { enumerable: true, get: function () { return testObjectProvider_js_1.TestObjectProvider; } });
|
|
34
42
|
Object.defineProperty(exports, "TestObjectProviderWithVersionedLoad", { enumerable: true, get: function () { return testObjectProvider_js_1.TestObjectProviderWithVersionedLoad; } });
|
|
35
43
|
var TestSummaryUtils_js_1 = require("./TestSummaryUtils.js");
|
|
@@ -45,6 +53,7 @@ Object.defineProperty(exports, "toIDeltaManagerFull", { enumerable: true, get: f
|
|
|
45
53
|
Object.defineProperty(exports, "waitForContainerConnection", { enumerable: true, get: function () { return containerUtils_js_1.waitForContainerConnection; } });
|
|
46
54
|
Object.defineProperty(exports, "getContainerEntryPointBackCompat", { enumerable: true, get: function () { return containerUtils_js_1.getContainerEntryPointBackCompat; } });
|
|
47
55
|
Object.defineProperty(exports, "getDataStoreEntryPointBackCompat", { enumerable: true, get: function () { return containerUtils_js_1.getDataStoreEntryPointBackCompat; } });
|
|
56
|
+
// #endregion
|
|
48
57
|
var testContainerRuntimeFactoryWithDefaultDataStore_js_1 = require("./testContainerRuntimeFactoryWithDefaultDataStore.js");
|
|
49
58
|
Object.defineProperty(exports, "createContainerRuntimeFactoryWithDefaultDataStore", { enumerable: true, get: function () { return testContainerRuntimeFactoryWithDefaultDataStore_js_1.createContainerRuntimeFactoryWithDefaultDataStore; } });
|
|
50
59
|
var testFluidObjectInternal_js_1 = require("./testFluidObjectInternal.js");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,mEAGkC;AAFjC,qIAAA,2BAA2B,OAAA;AAC3B,wIAAA,8BAA8B,OAAA;AAG/B,2DAM8B;AAJ7B,qHAAA,eAAe,OAAA;AAGf,4HAAA,sBAAsB,OAAA;AAEvB,mDAK0B;AAJzB,0HAAA,wBAAwB,OAAA;AACxB,8GAAA,YAAY,OAAA;AACZ,mHAAA,iBAAiB,OAAA;AACjB,oIAAA,kCAAkC,OAAA;AAEnC,uCAAoD;AAA3C,kHAAA,sBAAsB,OAAA;AAC/B,mDAAiF;AAAxE,0HAAA,wBAAwB,OAAA;AACjC,mFAG0C;AAFzC,mJAAA,iCAAiC,OAAA;AACjC,6IAAA,2BAA2B,OAAA;AAE5B,2DAK8B;AAH7B,qHAAA,eAAe,OAAA;AACf,4HAAA,sBAAsB,OAAA;AAIvB,wCAAwC;AACxC,yEAAyE;AACzE,iFAAiF;AACjF,+DAA+D;AAC/D,wEAAwE;AACxE,4EAA4E;AAC5E,oDAAoD;AACpD,yEAAqE;AAA5D,mIAAA,sBAAsB,OAAA;AAO/B,iEAKiC;AAJhC,yHAAA,gBAAgB,OAAA;AAChB,8HAAA,qBAAqB,OAAA;AACrB,2HAAA,kBAAkB,OAAA;AAClB,4IAAA,mCAAmC,OAAA;AAGpC,6DAK+B;AAJ9B,uHAAA,gBAAgB,OAAA;AAChB,2HAAA,oBAAoB,OAAA;AACpB,kIAAA,2BAA2B,OAAA;AAC3B,mHAAA,YAAY,OAAA;AAEb,qDAM2B;AAL1B,+GAAA,YAAY,OAAA;AACZ,iHAAA,cAAc,OAAA;AAKf,yDAK6B;AAJ5B,wHAAA,mBAAmB,OAAA;AACnB,+HAAA,0BAA0B,OAAA;AAC1B,qIAAA,gCAAgC,OAAA;AAChC,qIAAA,gCAAgC,OAAA;AAEjC,aAAa;AAEb,2HAI8D;AAD7D,uLAAA,iDAAiD,OAAA;AAGlD,2EAAuE;AAA9D,qIAAA,uBAAuB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport type { IEventAndErrorTrackingLogger } from \"./eventAndErrorLogger.js\";\nexport {\n\tEventAndErrorTrackingLogger,\n\tgetUnexpectedLogErrorException,\n} from \"./eventAndErrorLogger.js\";\nexport { IProvideTestFluidObject, ITestFluidObject } from \"./interfaces.js\";\nexport {\n\tfluidEntryPoint,\n\tLocalCodeLoader,\n\tSupportedExportInterfaces,\n\tFactory,\n\tcreateDataStoreFactory,\n} from \"./localCodeLoader.js\";\nexport {\n\tcreateAndAttachContainer,\n\tcreateLoader,\n\tcreateLoaderProps,\n\tcreateAndAttachContainerUsingProps,\n} from \"./localLoader.js\";\nexport { retryWithEventualValue } from \"./retry.js\";\nexport { createTestConfigProvider, ITestConfigProvider } from \"./TestConfigs.js\";\nexport {\n\tcreateTestContainerRuntimeFactory,\n\tTestContainerRuntimeFactory,\n} from \"./testContainerRuntimeFactory.js\";\nexport {\n\tChannelFactoryRegistry,\n\tTestFluidObject,\n\tTestFluidObjectFactory,\n\tTestDataObjectKind,\n} from \"./testFluidObject.js\";\n\n// #region Exports with load side-effect\n// The below runtime (not \"type\") exports transitively or directly import\n// timeoutUtils.ts, which always executes on import and may patch Mocha's timeout\n// handling. That patching only takes effect when consumers use\n// @fluid-internal/mocha-test-setup that sets globalThis.getMochaModule.\n// @fluid-internal/mocha-test-setup is pervasive in our tests and thus patch\n// is usually in effect (when this package is used).\nexport { LoaderContainerTracker } from \"./loaderContainerTracker.js\";\nexport type {\n\tIDocumentIdStrategy,\n\tIOpProcessingController,\n\tITestContainerConfig,\n\tITestObjectProvider,\n} from \"./testObjectProvider.js\";\nexport {\n\tcreateDocumentId,\n\tDataObjectFactoryType,\n\tTestObjectProvider,\n\tTestObjectProviderWithVersionedLoad,\n} from \"./testObjectProvider.js\";\nexport type { SummaryInfo } from \"./TestSummaryUtils.js\";\nexport {\n\tcreateSummarizer,\n\tcreateSummarizerCore,\n\tcreateSummarizerFromFactory,\n\tsummarizeNow,\n} from \"./TestSummaryUtils.js\";\nexport {\n\ttimeoutAwait,\n\ttimeoutPromise,\n\ttype TimeoutDurationOption,\n\ttype TimeoutWithError,\n\ttype TimeoutWithValue,\n} from \"./timeoutUtils.js\";\nexport {\n\ttoIDeltaManagerFull,\n\twaitForContainerConnection,\n\tgetContainerEntryPointBackCompat,\n\tgetDataStoreEntryPointBackCompat,\n} from \"./containerUtils.js\";\n// #endregion\n\nexport {\n\ttype ContainerRuntimeFactoryWithDefaultDataStoreConstructor,\n\ttype ContainerRuntimeFactoryWithDefaultDataStoreProps,\n\tcreateContainerRuntimeFactoryWithDefaultDataStore,\n} from \"./testContainerRuntimeFactoryWithDefaultDataStore.js\";\n\nexport { TestFluidObjectInternal } from \"./testFluidObjectInternal.js\";\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/test-utils";
|
|
8
|
-
export declare const pkgVersion = "2.
|
|
8
|
+
export declare const pkgVersion = "2.91.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/test-utils";
|
|
11
|
-
exports.pkgVersion = "2.
|
|
11
|
+
exports.pkgVersion = "2.91.0";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,4BAA4B,CAAC;AACvC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/test-utils\";\nexport const pkgVersion = \"2.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,4BAA4B,CAAC;AACvC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/test-utils\";\nexport const pkgVersion = \"2.91.0\";\n"]}
|
|
@@ -6,10 +6,12 @@ import { ITestDriver } from "@fluid-internal/test-driver-definitions";
|
|
|
6
6
|
import { IContainer, IFluidCodeDetails, IHostLoader } from "@fluidframework/container-definitions/internal";
|
|
7
7
|
import { ILoaderProps, Loader } from "@fluidframework/container-loader/internal";
|
|
8
8
|
import type { IContainerRuntimeOptionsInternal } from "@fluidframework/container-runtime/internal";
|
|
9
|
-
import { IRequestHeader,
|
|
9
|
+
import { IRequestHeader, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
10
10
|
import { IDocumentServiceFactory, IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions/internal";
|
|
11
11
|
import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
|
|
12
|
-
import { type
|
|
12
|
+
import { type ITelemetryLoggerPropertyBags } from "@fluidframework/telemetry-utils/internal";
|
|
13
|
+
import type { IEventAndErrorTrackingLogger } from "./eventAndErrorLogger.js";
|
|
14
|
+
import { EventAndErrorTrackingLogger } from "./eventAndErrorLogger.js";
|
|
13
15
|
import { fluidEntryPoint } from "./localCodeLoader.js";
|
|
14
16
|
import { ChannelFactoryRegistry } from "./testFluidObject.js";
|
|
15
17
|
/**
|
|
@@ -207,44 +209,6 @@ export interface IDocumentIdStrategy {
|
|
|
207
209
|
*/
|
|
208
210
|
reset(): void;
|
|
209
211
|
}
|
|
210
|
-
/** @internal */
|
|
211
|
-
export interface IEventAndErrorTrackingLogger {
|
|
212
|
-
registerExpectedEvent: (...orderedExpectedEvents: ITelemetryGenericEventExt[]) => void;
|
|
213
|
-
reportAndClearTrackedEvents: () => {
|
|
214
|
-
expectedNotFound: {
|
|
215
|
-
index: number;
|
|
216
|
-
event: ITelemetryGenericEventExt;
|
|
217
|
-
}[];
|
|
218
|
-
unexpectedErrors: ITelemetryBaseEvent[];
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* This class tracks events. It allows specifying expected events, which will be looked for in order.
|
|
223
|
-
* It also tracks all unexpected errors.
|
|
224
|
-
* At any point you call reportAndClearTrackedEvents which will provide all unexpected errors, and
|
|
225
|
-
* any expected events that have not occurred.
|
|
226
|
-
* @internal
|
|
227
|
-
*/
|
|
228
|
-
export declare class EventAndErrorTrackingLogger implements ITelemetryBaseLogger, IEventAndErrorTrackingLogger {
|
|
229
|
-
private readonly baseLogger?;
|
|
230
|
-
/**
|
|
231
|
-
* Even if these error events are logged, tests should still be allowed to pass
|
|
232
|
-
* Additionally, if downgrade is true, then log as generic (e.g. to avoid polluting the e2e test logs)
|
|
233
|
-
*/
|
|
234
|
-
private readonly allowedErrors;
|
|
235
|
-
constructor(baseLogger?: ITelemetryBaseLogger | undefined);
|
|
236
|
-
private readonly expectedEvents;
|
|
237
|
-
private readonly unexpectedErrors;
|
|
238
|
-
registerExpectedEvent(...orderedExpectedEvents: ITelemetryGenericEventExt[]): void;
|
|
239
|
-
send(event: ITelemetryBaseEvent): void;
|
|
240
|
-
reportAndClearTrackedEvents(): {
|
|
241
|
-
expectedNotFound: {
|
|
242
|
-
index: number;
|
|
243
|
-
event: ITelemetryGenericEventExt;
|
|
244
|
-
}[];
|
|
245
|
-
unexpectedErrors: ITelemetryBaseEvent[];
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
212
|
/**
|
|
249
213
|
* Shared base class for test object provider. Contain code for loader and container creation and loading
|
|
250
214
|
* @internal
|
|
@@ -478,10 +442,4 @@ export declare class TestObjectProviderWithVersionedLoad implements ITestObjectP
|
|
|
478
442
|
*/
|
|
479
443
|
resetLoaderContainerTracker(syncSummarizerClients?: boolean): void;
|
|
480
444
|
}
|
|
481
|
-
/**
|
|
482
|
-
* Retrieves unexpected errors from a logger and returns them as an exception.
|
|
483
|
-
*
|
|
484
|
-
* @internal
|
|
485
|
-
*/
|
|
486
|
-
export declare function getUnexpectedLogErrorException(logger: IEventAndErrorTrackingLogger | undefined, prefix?: string): Error | undefined;
|
|
487
445
|
//# sourceMappingURL=testObjectProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testObjectProvider.d.ts","sourceRoot":"","sources":["../src/testObjectProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAmB,MAAM,yCAAyC,CAAC;AACvF,OAAO,EACN,UAAU,EACV,iBAAiB,EACjB,WAAW,EAEX,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACN,YAAY,EACZ,MAAM,EAEN,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,4CAA4C,CAAC;AACnG,OAAO,EACN,cAAc,EACd,
|
|
1
|
+
{"version":3,"file":"testObjectProvider.d.ts","sourceRoot":"","sources":["../src/testObjectProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAmB,MAAM,yCAAyC,CAAC;AACvF,OAAO,EACN,UAAU,EACV,iBAAiB,EACjB,WAAW,EAEX,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACN,YAAY,EACZ,MAAM,EAEN,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,4CAA4C,CAAC;AACnG,OAAO,EACN,cAAc,EACd,oBAAoB,EAGpB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACN,uBAAuB,EACvB,YAAY,EACZ,YAAY,EACZ,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAGN,KAAK,4BAA4B,EAGjC,MAAM,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hF"}
|
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.TestObjectProviderWithVersionedLoad = exports.TestObjectProvider = exports.createDocumentId = exports.DataObjectFactoryType = void 0;
|
|
8
8
|
const internal_1 = require("@fluidframework/container-loader/internal");
|
|
9
9
|
const internal_2 = require("@fluidframework/core-utils/internal");
|
|
10
10
|
const internal_3 = require("@fluidframework/odsp-driver/internal");
|
|
11
11
|
const internal_4 = require("@fluidframework/telemetry-utils/internal");
|
|
12
12
|
const uuid_1 = require("uuid");
|
|
13
|
+
const eventAndErrorLogger_js_1 = require("./eventAndErrorLogger.js");
|
|
13
14
|
const loaderContainerTracker_js_1 = require("./loaderContainerTracker.js");
|
|
14
15
|
const localCodeLoader_js_1 = require("./localCodeLoader.js");
|
|
15
16
|
const localLoader_js_1 = require("./localLoader.js");
|
|
16
|
-
const nonEmptyArrayType_js_1 = require("./nonEmptyArrayType.js");
|
|
17
17
|
const defaultCodeDetails = {
|
|
18
18
|
package: "defaultTestPackage",
|
|
19
19
|
config: {},
|
|
@@ -61,87 +61,6 @@ function getDocumentIdStrategy(type) {
|
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
/**
|
|
65
|
-
* This class tracks events. It allows specifying expected events, which will be looked for in order.
|
|
66
|
-
* It also tracks all unexpected errors.
|
|
67
|
-
* At any point you call reportAndClearTrackedEvents which will provide all unexpected errors, and
|
|
68
|
-
* any expected events that have not occurred.
|
|
69
|
-
* @internal
|
|
70
|
-
*/
|
|
71
|
-
class EventAndErrorTrackingLogger {
|
|
72
|
-
constructor(baseLogger) {
|
|
73
|
-
this.baseLogger = baseLogger;
|
|
74
|
-
/**
|
|
75
|
-
* Even if these error events are logged, tests should still be allowed to pass
|
|
76
|
-
* Additionally, if downgrade is true, then log as generic (e.g. to avoid polluting the e2e test logs)
|
|
77
|
-
*/
|
|
78
|
-
this.allowedErrors = [
|
|
79
|
-
// This log was removed in current version as unnecessary, but it's still present in previous versions
|
|
80
|
-
{
|
|
81
|
-
eventName: "fluid:telemetry:Container:NoRealStorageInDetachedContainer",
|
|
82
|
-
downgrade: true,
|
|
83
|
-
},
|
|
84
|
-
// This log's category changes depending on the op latency. test results shouldn't be affected but if we see lots we'd like an alert from the logs.
|
|
85
|
-
{ eventName: "fluid:telemetry:OpRoundtripTime" },
|
|
86
|
-
];
|
|
87
|
-
this.expectedEvents = [];
|
|
88
|
-
this.unexpectedErrors = [];
|
|
89
|
-
}
|
|
90
|
-
registerExpectedEvent(...orderedExpectedEvents) {
|
|
91
|
-
if (this.expectedEvents.length !== 0) {
|
|
92
|
-
// we don't have to error here. just no reason not to. given the events must be
|
|
93
|
-
// ordered it could be tricky to figure out problems around multiple registrations.
|
|
94
|
-
throw new Error("Expected events already registered.\n" +
|
|
95
|
-
"Call reportAndClearTrackedEvents to clear them before registering more");
|
|
96
|
-
}
|
|
97
|
-
this.expectedEvents.push(...orderedExpectedEvents.map((event, index) => ({ index, event })));
|
|
98
|
-
}
|
|
99
|
-
send(event) {
|
|
100
|
-
if ((0, nonEmptyArrayType_js_1.isNonEmptyArray)(this.expectedEvents)) {
|
|
101
|
-
const ee = this.expectedEvents[0].event;
|
|
102
|
-
if (ee.eventName === event.eventName) {
|
|
103
|
-
let matches = true;
|
|
104
|
-
for (const key of Object.keys(ee)) {
|
|
105
|
-
if (ee[key] !== event[key]) {
|
|
106
|
-
matches = false;
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (matches) {
|
|
111
|
-
// we found an expected event
|
|
112
|
-
// so remove it from the list of expected events
|
|
113
|
-
// and if it is an error, change it to generic
|
|
114
|
-
// this helps keep our telemetry clear of
|
|
115
|
-
// expected errors.
|
|
116
|
-
this.expectedEvents.shift();
|
|
117
|
-
if (event.category === "error") {
|
|
118
|
-
event.category = "generic";
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
if (event.category === "error") {
|
|
124
|
-
// Check to see if this error is allowed and if its category should be downgraded
|
|
125
|
-
const allowedError = this.allowedErrors.find(({ eventName }) => eventName === event.eventName);
|
|
126
|
-
if (allowedError === undefined) {
|
|
127
|
-
this.unexpectedErrors.push(event);
|
|
128
|
-
}
|
|
129
|
-
else if (allowedError.downgrade) {
|
|
130
|
-
event.category = "generic";
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
this.baseLogger?.send(event);
|
|
134
|
-
}
|
|
135
|
-
reportAndClearTrackedEvents() {
|
|
136
|
-
const expectedNotFound = this.expectedEvents.splice(0, this.expectedEvents.length);
|
|
137
|
-
const unexpectedErrors = this.unexpectedErrors.splice(0, this.unexpectedErrors.length);
|
|
138
|
-
return {
|
|
139
|
-
expectedNotFound,
|
|
140
|
-
unexpectedErrors,
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
exports.EventAndErrorTrackingLogger = EventAndErrorTrackingLogger;
|
|
145
64
|
/**
|
|
146
65
|
* Shared base class for test object provider. Contain code for loader and container creation and loading
|
|
147
66
|
* @internal
|
|
@@ -178,7 +97,7 @@ class TestObjectProvider {
|
|
|
178
97
|
*/
|
|
179
98
|
get logger() {
|
|
180
99
|
if (this._logger === undefined) {
|
|
181
|
-
this._tracker = new EventAndErrorTrackingLogger(getTestLogger?.());
|
|
100
|
+
this._tracker = new eventAndErrorLogger_js_1.EventAndErrorTrackingLogger(getTestLogger?.());
|
|
182
101
|
this._logger = (0, internal_4.createChildLogger)({
|
|
183
102
|
logger: this._tracker,
|
|
184
103
|
properties: {
|
|
@@ -341,7 +260,7 @@ class TestObjectProvider {
|
|
|
341
260
|
this._documentServiceFactory = undefined;
|
|
342
261
|
this._urlResolver = undefined;
|
|
343
262
|
this._documentIdStrategy.reset();
|
|
344
|
-
const logError = getUnexpectedLogErrorException(this._tracker);
|
|
263
|
+
const logError = (0, eventAndErrorLogger_js_1.getUnexpectedLogErrorException)(this._tracker);
|
|
345
264
|
if (logError) {
|
|
346
265
|
throw logError;
|
|
347
266
|
}
|
|
@@ -420,7 +339,7 @@ class TestObjectProviderWithVersionedLoad {
|
|
|
420
339
|
*/
|
|
421
340
|
get logger() {
|
|
422
341
|
if (this._logger === undefined) {
|
|
423
|
-
this._tracker = new EventAndErrorTrackingLogger(getTestLogger?.());
|
|
342
|
+
this._tracker = new eventAndErrorLogger_js_1.EventAndErrorTrackingLogger(getTestLogger?.());
|
|
424
343
|
this._logger = (0, internal_4.createChildLogger)({
|
|
425
344
|
logger: this._tracker,
|
|
426
345
|
properties: this.telemetryProps,
|
|
@@ -621,7 +540,7 @@ class TestObjectProviderWithVersionedLoad {
|
|
|
621
540
|
this._documentServiceFactory = undefined;
|
|
622
541
|
this._urlResolver = undefined;
|
|
623
542
|
this._documentIdStrategy.reset();
|
|
624
|
-
const logError = getUnexpectedLogErrorException(this._tracker);
|
|
543
|
+
const logError = (0, eventAndErrorLogger_js_1.getUnexpectedLogErrorException)(this._tracker);
|
|
625
544
|
if (logError) {
|
|
626
545
|
throw logError;
|
|
627
546
|
}
|
|
@@ -685,30 +604,4 @@ function getUrlTelemetryProps(resolvedUrl) {
|
|
|
685
604
|
}
|
|
686
605
|
return (0, internal_4.tagData)(internal_4.TelemetryDataTag.UserData, props);
|
|
687
606
|
}
|
|
688
|
-
/** Summarize the event with just the primary properties, for succinct output in case of test failure */
|
|
689
|
-
const primaryEventProps = ({ category, eventName, error, errorType, }) => ({
|
|
690
|
-
category,
|
|
691
|
-
eventName,
|
|
692
|
-
error,
|
|
693
|
-
errorType,
|
|
694
|
-
["..."]: "*** Additional properties not shown, see full log for details ***",
|
|
695
|
-
});
|
|
696
|
-
/**
|
|
697
|
-
* Retrieves unexpected errors from a logger and returns them as an exception.
|
|
698
|
-
*
|
|
699
|
-
* @internal
|
|
700
|
-
*/
|
|
701
|
-
function getUnexpectedLogErrorException(logger, prefix) {
|
|
702
|
-
if (logger === undefined) {
|
|
703
|
-
return;
|
|
704
|
-
}
|
|
705
|
-
const results = logger.reportAndClearTrackedEvents();
|
|
706
|
-
if (results.unexpectedErrors.length > 0) {
|
|
707
|
-
return new Error(`${prefix ?? ""}Unexpected Errors in Logs:\n${JSON.stringify(results.unexpectedErrors.map(primaryEventProps), undefined, 2)}`);
|
|
708
|
-
}
|
|
709
|
-
if (results.expectedNotFound.length > 0) {
|
|
710
|
-
return new Error(`${prefix ?? ""}Expected Events not found:\n${JSON.stringify(results.expectedNotFound, undefined, 2)}`);
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
exports.getUnexpectedLogErrorException = getUnexpectedLogErrorException;
|
|
714
607
|
//# sourceMappingURL=testObjectProvider.js.map
|