@amazon/vinyl-util 4.0.0 → 4.0.1-next.20261016184530
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/browserTestUtil/index.js +1 -1
- package/dist/browserTestUtil/index.js.map +2 -2
- package/dist/browserTestUtil/types/current/mock/dom/lib.dom.d.ts.map +1 -1
- package/dist/browserTestUtil/types/current/mock/dom/lib.dom.js +1 -1
- package/dist/browserTestUtil/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/test/benchmark.es5.js +1 -1
- package/dist/test/benchmark.js +1 -1
- package/dist/test/benchmark.js.map +2 -2
- package/dist/testUtil/index.js +53 -9
- package/dist/testUtil/index.js.map +2 -2
- package/dist/testUtil/types/current/reporters/LogReporter.d.ts +21 -0
- package/dist/testUtil/types/current/reporters/LogReporter.d.ts.map +1 -1
- package/dist/testUtil/types/current/reporters/LogReporter.js +23 -2
- package/dist/testUtil/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/testUtil/types/current/util/event/createEventSpy.d.ts.map +1 -1
- package/dist/testUtil/types/current/util/event/createEventSpy.js +36 -6
- package/dist/testUtil/types/ts3.7/reporters/LogReporter.d.ts +21 -0
- package/dist/testUtil/types/ts4.1/reporters/LogReporter.d.ts +21 -0
- package/dist/testUtil/types/ts4.7/reporters/LogReporter.d.ts +21 -0
- package/dist/unit/types/current/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
package/dist/testUtil/index.js
CHANGED
|
@@ -297,6 +297,8 @@ var LogReporter = class {
|
|
|
297
297
|
* failedExpectations, save this from `specDone`.
|
|
298
298
|
*/
|
|
299
299
|
__publicField(this, "failedResult", null);
|
|
300
|
+
__publicField(this, "failures", []);
|
|
301
|
+
__publicField(this, "statusCounts", {});
|
|
300
302
|
__publicField(this, "totalSpecs", 0);
|
|
301
303
|
__publicField(this, "totalCompleted", 0);
|
|
302
304
|
/**
|
|
@@ -327,13 +329,29 @@ var LogReporter = class {
|
|
|
327
329
|
this.maybeReportProgress();
|
|
328
330
|
}
|
|
329
331
|
specDone(result) {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
+
var _a, _b;
|
|
333
|
+
if (result.status === "failed") {
|
|
334
|
+
(_a = this.failedResult) != null ? _a : this.failedResult = result;
|
|
335
|
+
this.addFailure(result.fullName, result.failedExpectations);
|
|
336
|
+
}
|
|
337
|
+
this.statusCounts[result.status] = ((_b = this.statusCounts[result.status]) != null ? _b : 0) + 1;
|
|
332
338
|
this.totalCompleted++;
|
|
333
339
|
this.maybeReportProgress();
|
|
334
340
|
}
|
|
341
|
+
suiteDone(result) {
|
|
342
|
+
if (result.failedExpectations.length)
|
|
343
|
+
this.addFailure(result.fullName, result.failedExpectations);
|
|
344
|
+
}
|
|
345
|
+
addFailure(fullName, failedExpectations) {
|
|
346
|
+
this.failures.push({
|
|
347
|
+
fullName,
|
|
348
|
+
messages: failedExpectations.map((e) => e.message)
|
|
349
|
+
});
|
|
350
|
+
}
|
|
335
351
|
jasmineDone(runDetails) {
|
|
336
352
|
var _a;
|
|
353
|
+
if (runDetails.failedExpectations.length)
|
|
354
|
+
this.addFailure("top level", runDetails.failedExpectations);
|
|
337
355
|
this.maybeReportProgress(true);
|
|
338
356
|
this.consoleInterceptor.dispose();
|
|
339
357
|
const reason = this.failedResult ? `${this.failedResult.fullName}:
|
|
@@ -343,7 +361,10 @@ ${(_a = this.failedResult.failedExpectations[0]) == null ? void 0 : _a.message}`
|
|
|
343
361
|
overallStatus: runDetails.overallStatus === "incomplete" ? "passed" : runDetails.overallStatus,
|
|
344
362
|
totalCompleted: this.totalCompleted,
|
|
345
363
|
totalSpecs: this.totalSpecs,
|
|
346
|
-
reason
|
|
364
|
+
reason,
|
|
365
|
+
statusCounts: this.statusCounts,
|
|
366
|
+
failures: this.failures,
|
|
367
|
+
seed: String(runDetails.order.seed)
|
|
347
368
|
};
|
|
348
369
|
this.onDone(body).catch((_) => {
|
|
349
370
|
this.onDone(body).catch((e) => {
|
|
@@ -503,8 +524,14 @@ function logArgsToStr(args) {
|
|
|
503
524
|
}
|
|
504
525
|
|
|
505
526
|
// test/testUtil/util/event/createEventSpy.ts
|
|
506
|
-
import { Deferred, substitute,
|
|
527
|
+
import { Abort, Deferred, substitute, timeout } from "@amazon/vinyl-util";
|
|
507
528
|
var createSpy2 = jasmine.createSpy;
|
|
529
|
+
var pendingTimeouts = /* @__PURE__ */ new Set();
|
|
530
|
+
if (typeof afterEach === "function")
|
|
531
|
+
afterEach(() => {
|
|
532
|
+
for (const abort of pendingTimeouts) abort.abort();
|
|
533
|
+
pendingTimeouts.clear();
|
|
534
|
+
});
|
|
508
535
|
function createEventSpy(host, type) {
|
|
509
536
|
const spy = createSpy2(String(type));
|
|
510
537
|
let nextCall = new Deferred();
|
|
@@ -514,12 +541,29 @@ function createEventSpy(host, type) {
|
|
|
514
541
|
});
|
|
515
542
|
const unsub = host.on(type, spy);
|
|
516
543
|
return Object.assign(spy, {
|
|
517
|
-
next(
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
544
|
+
next(time = 5, timeoutMessage = `event '{type}' has not been dispatched after {timeout}s.`) {
|
|
545
|
+
const call = nextCall;
|
|
546
|
+
const abort = new Abort();
|
|
547
|
+
pendingTimeouts.add(abort);
|
|
548
|
+
const settle = () => {
|
|
549
|
+
abort.abort();
|
|
550
|
+
pendingTimeouts.delete(abort);
|
|
551
|
+
};
|
|
552
|
+
return Promise.race([
|
|
553
|
+
call,
|
|
554
|
+
timeout(time, {
|
|
555
|
+
abort,
|
|
556
|
+
message: substitute(timeoutMessage, {
|
|
557
|
+
type,
|
|
558
|
+
timeout: time
|
|
559
|
+
})
|
|
522
560
|
})
|
|
561
|
+
]).then(() => {
|
|
562
|
+
settle();
|
|
563
|
+
return call;
|
|
564
|
+
}).catch((error) => {
|
|
565
|
+
settle();
|
|
566
|
+
throw error;
|
|
523
567
|
});
|
|
524
568
|
},
|
|
525
569
|
dispose: unsub
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../test/testUtil/error/uncaughtErrorUtil.ts", "../../test/testUtil/global/overrideGlobalInit.ts", "../../test/testUtil/mock/event/emptyLogTarget.ts", "../../test/testUtil/mock/event/MockEventHost.ts", "../../test/testUtil/mock/logging/MockLogger.ts", "../../test/testUtil/mock/navigator/setMockNavigator.ts", "../../test/testUtil/mock/util/spyOnPropertySafe.ts", "../../test/testUtil/mock/network/emptyRequestInfo.ts", "../../test/testUtil/mock/network/MockNetworkInformation.ts", "../../test/testUtil/mock/network/MockNetworkMetricsController.ts", "../../test/testUtil/mock/network/MockNetworkState.ts", "../../test/testUtil/mock/network/MockRequester.ts", "../../test/testUtil/mock/persistence/MockPersistence.ts", "../../test/testUtil/reporters/LogReporter.ts", "../../test/testUtil/util/initializeUncaughtErrorLogging.ts", "../../test/testUtil/reporters/RestApiReporter.ts", "../../test/testUtil/util/event/createEventSpy.ts"],
|
|
4
|
-
"sourcesContent": ["/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { CodeRange } from '@amazon/vinyl-util'\nimport { parseStackLocation } from '@amazon/vinyl-util'\nimport type { MockEventTarget } from '@amazon/vinyl-util/browserTestUtil'\nimport {\n MockErrorEvent,\n MockPromiseRejectionEvent,\n} from '@amazon/vinyl-util/browserTestUtil'\n\n/**\n * Creates a code range object surrounding the given error.\n */\nexport function createRangeSurrounding(error: Error): CodeRange {\n const location = parseStackLocation(error.stack)\n if (!location) {\n pending('Cannot parse stacks in this environment.')\n return { start: null, end: null }\n }\n return {\n start: {\n source: location.source,\n file: location.file,\n row: location.row,\n col: (location.col ?? 0) - 1,\n },\n end: {\n source: location.source,\n file: location.file,\n row: location.row,\n col: (location.col ?? 0) + 1,\n },\n }\n}\n\n/**\n * Simulates an uncaught error event.\n */\nexport function throwMockError(target: MockEventTarget, error: any) {\n expect(target.removeEventListener).not.toHaveBeenCalled()\n const event = new MockErrorEvent()\n event.type = 'error'\n event.error = error\n target.dispatchEvent(event)\n}\n\n/**\n * Simulates an unhandled rejection to be caught by the global unhandled promise handler.\n */\nexport function rejectMockPromise(target: MockEventTarget, reason: any) {\n expect(target.removeEventListener).not.toHaveBeenCalled()\n // Not all environments can construct `PromiseRejectionEvent`\n const event = new MockPromiseRejectionEvent()\n event.type = 'unhandledrejection'\n event.reason = reason\n event.promise = Promise.reject(reason as Error).catch(() => void 0)\n target.dispatchEvent(event)\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { GlobalRef } from '@amazon/vinyl-util'\n\nexport function overrideGlobalInit<T, U extends T>(\n initHandle: GlobalRef<T>,\n initOverride: () => U\n): { readonly value: U } {\n beforeEach(() => {\n initHandle.set(initOverride)\n })\n return initHandle as GlobalRef<U>\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { LogTarget } from '@amazon/vinyl-util'\n\nexport const emptyLogTarget: LogTarget = {\n logPrefix: 'path',\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { EventHostImpl } from '@amazon/vinyl-util'\nimport type { SpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\n/**\n * MockEventHost creates spies with pass-through calls to the EventHost implementation.\n * While this is not a true mock, events become easier to test when using a real event dispatcher.\n */\nexport class MockEventHost<EventMap = any> extends EventHostImpl<EventMap> {\n private readonly spyFactory: SpyFactory<EventHostImpl<EventMap>> =\n createSpyFactory((key) => {\n return super[key].bind(this)\n })\n\n logPrefix = 'MockEventHost'\n hasAnyListeners = this.spyFactory('hasAnyListeners')\n hasListeners = this.spyFactory('hasListeners')\n dispatch = this.spyFactory('dispatch')\n on = this.spyFactory('on')\n dispose = this.spyFactory('dispose')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { LogEventMap, Logger, LogTarget } from '@amazon/vinyl-util'\nimport { loggerRef, LogLevel } from '@amazon/vinyl-util'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { overrideGlobalInit } from '../../global/overrideGlobalInit'\nimport { MockEventHost } from '../event/MockEventHost'\nimport createSpy = jasmine.createSpy\n\ntype LogFilterFun = (target: LogTarget, ...messages: any[]) => void\n\nconst spyFactory = createSpyFactory<Logger>()\nexport class MockLogger extends MockEventHost<LogEventMap> implements Logger {\n logLevel: LogLevel = LogLevel.DEBUG\n\n log = spyFactory('log').and.callFake((target, level, ...messages) => {\n switch (level) {\n // Delegates logs to spies separated by log level.\n case LogLevel.VERBOSE:\n this.verbose(target, ...messages)\n break\n case LogLevel.DEBUG:\n this.debug(target, ...messages)\n break\n case LogLevel.INFO:\n this.info(target, ...messages)\n break\n case LogLevel.WARN:\n this.warn(target, ...messages)\n break\n case LogLevel.ERROR:\n this.error(target, ...messages)\n break\n }\n })\n\n verbose = createSpy<LogFilterFun>('verbose')\n debug = createSpy<LogFilterFun>('debug')\n info = createSpy<LogFilterFun>('info')\n warn = createSpy<LogFilterFun>('warn')\n error = createSpy<LogFilterFun>('error')\n}\n\nexport function useMockLogger(): { readonly value: MockLogger } {\n return overrideGlobalInit(loggerRef, () => new MockLogger())\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { MockNavigator } from '@amazon/vinyl-util/browserTestUtil'\nimport { spyOnPropertySafe } from '../util/spyOnPropertySafe'\n\n/**\n * Sets the global navigator to a Mock\n * Returns the new MockNavigator instance.\n */\nexport function setMockNavigator(): MockNavigator {\n const navigator = new MockNavigator()\n spyOnPropertySafe(global, 'navigator').and.returnValue(navigator)\n return navigator\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * A wrapper to jasmine spyOnProperty for property getters that will define property\n * if it doesn't exist.\n */\nexport function spyOnPropertySafe<\n T extends object,\n K extends keyof T = keyof T,\n>(object: T, property: K): jasmine.Spy<(this: T) => T[K]> {\n if (!(property in object)) {\n // Object does not have property attempting to be mocked\n // define it (with an undefined value) to allow spyOnProperty to succeed.\n Object.defineProperty(object, property, {\n configurable: true,\n enumerable: true,\n get: () => undefined,\n })\n }\n return spyOnProperty(object, property, 'get')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n//-------------------------------------------------------------\n// Empty FetchCompletedInfo objects for tests.\n//-------------------------------------------------------------\n\nimport {\n ErrorBodyType,\n type FetchRequestInfo,\n type RequestAttemptInfo,\n type RequestCaughtErrorEvent,\n type RequestNetworkErrorEvent,\n type RequestResponseErrorEvent,\n type RequestSuccessEvent,\n type ResponseInfo,\n} from '@amazon/vinyl-util'\nimport { RequestFailureType } from '@amazon/vinyl-util'\n\nexport const emptyRequestInfo: FetchRequestInfo = {\n requestId: '',\n requestOptions: { readErrorBody: ErrorBodyType.DISABLED, serviceId: null },\n init: {},\n input: '',\n maxRetries: 0,\n timestamp: 0,\n}\n\nexport const emptyRequestAttemptInfo: RequestAttemptInfo = {\n currentTry: 0,\n timestamp: 0,\n}\n\nexport const emptyResponseInfo: ResponseInfo = {\n ok: false,\n redirected: false,\n status: 0,\n statusText: '',\n type: 'default',\n url: '',\n contentLength: 0,\n}\n\nexport const emptyRequestSuccessEvent: RequestSuccessEvent = {\n ok: true,\n requestInfo: emptyRequestInfo,\n timestamp: 0,\n attemptInfo: emptyRequestAttemptInfo,\n responseInfo: emptyResponseInfo,\n}\n\nexport const emptyInternalError: RequestCaughtErrorEvent = {\n ok: false,\n reason: null,\n requestInfo: emptyRequestInfo,\n retryAfter: null,\n timestamp: 0,\n type: RequestFailureType.INTERNAL,\n willRetry: false,\n}\n\nexport const emptyNetworkError: RequestNetworkErrorEvent = {\n ok: false,\n reason: null,\n requestInfo: emptyRequestInfo,\n retryAfter: null,\n timestamp: 0,\n type: RequestFailureType.NETWORK,\n willRetry: false,\n attemptInfo: emptyRequestAttemptInfo,\n}\n\nexport const emptyResponseError: RequestResponseErrorEvent = {\n ok: false,\n reason: null,\n requestInfo: emptyRequestInfo,\n retryAfter: null,\n timestamp: 0,\n type: RequestFailureType.RESPONSE,\n willRetry: false,\n attemptInfo: emptyRequestAttemptInfo,\n responseInfo: emptyResponseInfo,\n}\n\nexport const emptyAbortError: RequestCaughtErrorEvent = {\n ...emptyInternalError,\n type: RequestFailureType.ABORT,\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {\n NetworkInformation,\n NetworkInformationEffectiveType,\n NetworkInformationType,\n} from '@amazon/vinyl-util'\nimport { MockEventTarget } from '@amazon/vinyl-util/browserTestUtil'\n\nexport class MockNetworkInformation\n extends MockEventTarget\n implements NetworkInformation\n{\n downlink: number | undefined = undefined\n effectiveType: NetworkInformationEffectiveType = '4g'\n rtt = 0\n saveData = false\n type?: NetworkInformationType = undefined\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {\n NetworkMetrics,\n NetworkMetricsController,\n NetworkMetricsEventMap,\n} from '@amazon/vinyl-util'\nimport { EMPTY_NETWORK_METRICS } from '@amazon/vinyl-util'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\nimport { MockEventHost } from '../event/MockEventHost'\n\nconst spyFactory = createSpyFactory<NetworkMetricsController>()\nexport class MockNetworkMetricsController\n extends MockEventHost<NetworkMetricsEventMap>\n implements NetworkMetricsController\n{\n maxHistorySize = 0\n\n metrics: NetworkMetrics = EMPTY_NETWORK_METRICS\n\n addMetricsEntry = spyFactory('addMetricsEntry')\n\n getServiceMetrics = spyFactory('getServiceMetrics')\n\n addDownlinkTransferEntry = spyFactory('addDownlinkTransferEntry')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { NetworkState, NetworkStateEventMap } from '@amazon/vinyl-util'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { MockEventHost } from '../event/MockEventHost'\n\nconst spyFactory = createSpyFactory<NetworkState>()\nexport class MockNetworkState\n extends MockEventHost<NetworkStateEventMap>\n implements NetworkState\n{\n onLine = false\n\n nextOnLine = spyFactory('nextOnLine')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Requester, RequesterImplEventMap } from '@amazon/vinyl-util'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { MockEventHost } from '../event/MockEventHost'\n\nconst spyFactory = createSpyFactory<Requester>()\nexport class MockRequester\n extends MockEventHost<RequesterImplEventMap>\n implements Requester\n{\n request = spyFactory('request')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport type { KeyValuePersistence } from '@amazon/vinyl-util'\n\nexport class MockPersistence<T = any> implements KeyValuePersistence<T> {\n private readonly spyFactory = createSpyFactory<KeyValuePersistence<T>>()\n\n clear = this.spyFactory('clear')\n\n get = this.spyFactory('get')\n\n remove = this.spyFactory('remove')\n\n set = this.spyFactory('set')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport CustomReporter = jasmine.CustomReporter\nimport JasmineDoneInfo = jasmine.JasmineDoneInfo\nimport JasmineStartedInfo = jasmine.JasmineStartedInfo\nimport SpecResult = jasmine.SpecResult\nimport { LogLevel, type ReadonlyDate } from '@amazon/vinyl-util'\n\n/**\n * The minimum number of seconds between progress reports.\n */\nconst UPDATE_INTERVAL = 1\n\n/**\n * The maximum number of log statements before forcing a flush.\n * This can be reached if a single test is long-running and has excessive logs.\n */\nconst MAX_LOGS_BUFFER = 200\n\nexport interface LogReporterStartedEvent {\n readonly totalSpecs: number\n}\n\nexport interface LogReporterProgressEvent {\n readonly totalCompleted: number\n readonly totalSpecs: number\n readonly logs: readonly LogEntry[]\n}\n\nexport interface LogReporterDoneEvent {\n readonly overallStatus: 'passed' | 'failed'\n readonly totalCompleted: number\n readonly totalSpecs: number\n readonly reason: string\n}\n\nexport interface LogEntry {\n readonly timestamp: ReadonlyDate\n readonly messages: readonly any[]\n readonly level: LogLevel\n}\n\nexport abstract class LogReporter implements CustomReporter {\n /**\n * The first failed spec.\n *\n * Jasmine's spec result in `jasmineDone` does not provide these correctly in\n * failedExpectations, save this from `specDone`.\n */\n private failedResult: SpecResult | null = null\n\n private totalSpecs = 0\n private totalCompleted = 0\n\n /**\n * The timestamp of the last progress update.\n */\n protected lastProgressTimestamp = 0\n protected updateInterval = UPDATE_INTERVAL\n protected maxLogsBuffer = MAX_LOGS_BUFFER\n\n private consoleInterceptor = new ConsoleInterceptor()\n\n private readonly logs: LogEntry[] = []\n\n protected constructor() {\n this.consoleInterceptor.onLog = (entry) => {\n this.logs.push(entry)\n if (this.logs.length >= this.maxLogsBuffer)\n this.maybeReportProgress(true)\n }\n }\n\n jasmineStarted(suiteInfo: JasmineStartedInfo): void {\n this.onStarted({\n totalSpecs: suiteInfo.totalSpecsDefined,\n }).catch((e) => {\n console.error(`'done' failed to report`, e)\n })\n this.totalCompleted = 0\n this.totalSpecs = suiteInfo.totalSpecsDefined\n }\n\n protected abstract onStarted(action: LogReporterStartedEvent): Promise<void>\n\n specStarted(result: SpecResult): void {\n // Log the running spec and flush immediately. A spec that hangs never\n // reaches specDone, so without this the buffered logs \u2014 and which spec\n // was running \u2014 never reach the reporter and the log just cuts off. The\n // forced flush makes the last logged spec name identify the culprit.\n console.info(`Running spec: ${result.fullName}`)\n this.maybeReportProgress()\n }\n\n specDone(result: SpecResult): void {\n if (!this.failedResult && result.status === 'failed')\n this.failedResult = result\n this.totalCompleted++\n this.maybeReportProgress()\n }\n\n jasmineDone(runDetails: JasmineDoneInfo): void {\n this.maybeReportProgress(true)\n this.consoleInterceptor.dispose()\n const reason = this.failedResult\n ? `${this.failedResult.fullName}:\\n${this.failedResult.failedExpectations[0]?.message}`\n : runDetails.overallStatus === 'incomplete'\n ? runDetails.incompleteReason\n : ''\n const body: LogReporterDoneEvent = {\n // one of: 'passed', 'failed', 'incomplete'\n overallStatus:\n runDetails.overallStatus === 'incomplete'\n ? 'passed'\n : (runDetails.overallStatus as 'passed' | 'failed'),\n totalCompleted: this.totalCompleted,\n totalSpecs: this.totalSpecs,\n reason,\n }\n this.onDone(body).catch((_) => {\n // One retry:\n this.onDone(body).catch((e) => {\n console.error(`'done' failed to report`, e)\n })\n })\n }\n\n /**\n * If there has not been a progress update within `updateInterval`, emit another progress\n * event.\n * @private\n */\n private maybeReportProgress(force: boolean = false) {\n const now = Date.now()\n if (\n force ||\n now - this.lastProgressTimestamp > this.updateInterval * 1000\n ) {\n const logs = this.logs.slice()\n this.logs.length = 0\n this.onProgress({\n totalCompleted: this.totalCompleted,\n totalSpecs: this.totalSpecs,\n logs,\n }).catch((e) => {\n console.error(`'progress' failed to report`, e)\n })\n this.lastProgressTimestamp = now\n }\n }\n\n protected abstract onProgress(\n action: LogReporterProgressEvent\n ): Promise<void>\n\n protected abstract onDone(action: LogReporterDoneEvent): Promise<void>\n}\n\nconst consoleMethods = [\n 'debug',\n 'log',\n 'info',\n 'warn',\n 'error',\n] as const satisfies (keyof Console)[]\n\nconst consoleMethodLevels: Record<string, LogLevel> = {\n debug: LogLevel.DEBUG,\n log: LogLevel.DEBUG,\n warn: LogLevel.WARN,\n info: LogLevel.INFO,\n error: LogLevel.ERROR,\n} as const\n\n/**\n * Intercepts console, logging to an array as well.\n */\nclass ConsoleInterceptor {\n private readonly originalMethods: Record<string, (...args: any[]) => void>\n\n /**\n * Invoked on every log statement.\n */\n onLog: ((entry: LogEntry) => void) | null = null\n\n constructor() {\n this.originalMethods = {}\n for (const consoleMethod of consoleMethods) {\n this.originalMethods[consoleMethod] = console[consoleMethod]\n console[consoleMethod] = (...args) => {\n if (this.onLog)\n this.onLog({\n level:\n consoleMethodLevels[consoleMethod] ??\n LogLevel.DEBUG,\n timestamp: new Date(),\n messages: args,\n })\n this.originalMethods[consoleMethod].apply(console, args)\n }\n }\n }\n\n dispose() {\n for (const consoleMethod of consoleMethods) {\n console[consoleMethod] = this.originalMethods[consoleMethod]\n }\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nlet loggingUncaughtErrors = false\n\n/**\n * Logs uncaught errors and promise rejections to the console, to be emitted to the report api.\n * Jasmine catches uncaught errors and only reports the message in the test failure, not the whole error event.\n */\nexport function initializeUncaughtErrorLogging() {\n if (loggingUncaughtErrors) return\n loggingUncaughtErrors = true\n window.addEventListener('error', (event) => {\n console.error('uncaught error event:', event)\n })\n\n window.addEventListener('unhandledrejection', (event) => {\n console.error('unhandled rejection:', event)\n })\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n type LogReporterProgressEvent,\n LogReporter,\n type LogReporterDoneEvent,\n type LogReporterStartedEvent,\n} from './LogReporter'\nimport { initializeUncaughtErrorLogging } from '../util/initializeUncaughtErrorLogging'\nimport { stringifyLogLevel } from '@amazon/vinyl-util'\n\nexport class RestApiReporter extends LogReporter {\n /**\n * Installs this reporter if this is a Browser environment and the report api has been provided as a query\n * parameter.\n * @param searchParam\n */\n static installFromSearchParam(searchParam: string = 'reportApi') {\n if (typeof location === 'undefined') return\n const url = new URL('about:blank')\n url.search = location.search\n // Uses `URL.searchParams` over `new URLSearchParams`; URLSearchParams constructor is not\n // as widely supported.\n const reportApi = url.searchParams.get(searchParam)\n if (reportApi) {\n jasmine.getEnv().addReporter(new RestApiReporter(reportApi))\n initializeUncaughtErrorLogging()\n }\n }\n\n constructor(private readonly reportApi: string) {\n super()\n }\n\n protected onStarted(action: LogReporterStartedEvent): Promise<void> {\n return this.doRequest('started', action)\n }\n\n protected onProgress(action: LogReporterProgressEvent): Promise<void> {\n return this.doRequest('progress', {\n totalCompleted: action.totalCompleted,\n totalSpecs: action.totalSpecs,\n logs: action.logs.map((logEntry) => [\n stringifyLogLevel(logEntry.level),\n logEntry.timestamp.toISOString(),\n logArgsToStr(logEntry.messages),\n ]),\n })\n }\n\n protected onDone(action: LogReporterDoneEvent): Promise<void> {\n return this.doRequest('done', action)\n }\n\n /**\n * If the reportApi url was set in the URL parameters, report to that URL the test progress.\n *\n * @param action One of: 'started', 'progress', or 'done'\n * @param body\n * @private\n */\n private async doRequest(\n action: 'started' | 'progress' | 'done',\n body: any\n ): Promise<void> {\n if (!this.reportApi) return\n const response = await fetch(`${this.reportApi}/${action}`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(body),\n })\n if (!response.ok)\n throw new Error(`${response.status} Error: ${response.statusText}`)\n return await response.json()\n }\n}\n\n/**\n * Converts the arguments to console logging to a string.\n * @param args\n */\nfunction logArgsToStr(args: readonly any[]): string {\n return args\n .map((arg) => {\n if (arg != null && typeof arg === 'object') {\n try {\n return JSON.stringify(arg)\n } catch (_) {\n return String(arg)\n }\n } else {\n return String(arg)\n }\n })\n .join(' ')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {\n Disposable,\n EventHandler,\n Fun,\n ReadonlyEventHost,\n} from '@amazon/vinyl-util'\nimport { Deferred, substitute, withTimeout } from '@amazon/vinyl-util'\nimport createSpy = jasmine.createSpy\nimport Spy = jasmine.Spy\n\n/**\n * A Spy that provides a way to promisify the next call and unsubscribe.\n *\n * Do not use `and` on an EventSpy, the callFake is used to provide the next promise.\n */\nexport interface EventSpy<EventMap, K extends keyof EventMap>\n extends Spy<EventHandler<EventMap[K]>>, Fun, Disposable {\n /**\n * Returns a promise that resolves when the event has next been dispatched, or rejects\n * if timeout has elapsed.\n *\n * @param timeout The number of seconds before a timeout.\n * @param timeoutMessage An optional timeout message to use instead of the default.\n * This may use two tokens:\n * {0} - The event type.\n * {1} - Number of seconds before the timeout.\n */\n next(timeout?: number, timeoutMessage?: string): Promise<EventMap[K]>\n}\n\n/**\n * Adds a listener to an event host, returning a spy for assertions.\n *\n * The returned spy provides a `next` function to promisify the next call and a `dispose` function\n * to unsubscribe.\n *\n * @param host\n * @param type\n */\nexport function createEventSpy<EventMap, K extends keyof EventMap>(\n host: ReadonlyEventHost<EventMap>,\n type: K\n): EventSpy<EventMap, K> {\n const spy = createSpy(String(type))\n let nextCall = new Deferred<EventMap[K]>()\n spy.and.callFake(() => {\n nextCall.resolve(spy.calls.mostRecent().args[0])\n nextCall = new Deferred<EventMap[K]>()\n })\n const unsub = host.on(type, spy)\n\n return Object.assign(spy, {\n next(\n timeout = 5,\n timeoutMessage = `event '{type}' has not been dispatched after {timeout}s.`\n ) {\n return withTimeout(nextCall, timeout, {\n message: substitute(timeoutMessage, {\n type,\n timeout,\n }),\n })\n },\n dispose: unsub,\n })\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAMA,SAAS,0BAA0B;AAEnC;AAAA,EACI;AAAA,EACA;AAAA,OACG;AAKA,SAAS,uBAAuB,OAAyB;AAhBhE;AAiBI,QAAMA,YAAW,mBAAmB,MAAM,KAAK;AAC/C,MAAI,CAACA,WAAU;AACX,YAAQ,0CAA0C;AAClD,WAAO,EAAE,OAAO,MAAM,KAAK,KAAK;AAAA,EACpC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;;AC/EA,SAAS,uBAAuB;AAEzB,IAAM,yBAAN,cACK,gBAEZ;AAAA,EAHO;AAAA;AAIH;AACA,yCAAiD;AACjD,+BAAM;AACN,oCAAW;AACX;AAAA;AACJ;;;ACXA,SAAS,6BAA6B;AACtC,SAAS,oBAAAC,yBAAwB;AAIjC,IAAMC,cAAaC,kBAA2C;AACvD,IAAM,+BAAN,cACK,cAEZ;AAAA,EAHO;AAAA;AAIH,0CAAiB;AAEjB,mCAA0B;AAE1B,2CAAkBD,YAAW,iBAAiB;AAE9C,6CAAoBA,YAAW,mBAAmB;AAElD,oDAA2BA,YAAW,0BAA0B;AAAA;AACpE;;;ACvBA,SAAS,oBAAAE,yBAAwB;AAGjC,IAAMC,cAAaC,kBAA+B;AAC3C,IAAM,mBAAN,cACK,cAEZ;AAAA,EAHO;AAAA;AAIH,kCAAS;AAET,sCAAaD,YAAW,YAAY;AAAA;AACxC;;;ACXA,SAAS,oBAAAE,yBAAwB;AAGjC,IAAMC,cAAaC,kBAA4B;AACxC,IAAM,gBAAN,cACK,cAEZ;AAAA,EAHO;AAAA;AAIH,mCAAUD,YAAW,SAAS;AAAA;AAClC;;;ACVA,SAAS,oBAAAE,yBAAwB;AAG1B,IAAM,kBAAN,MAAiE;AAAA,EAAjE;AACH,wBAAiB,cAAaC,kBAAyC;AAEvE,iCAAQ,KAAK,WAAW,OAAO;AAE/B,+BAAM,KAAK,WAAW,KAAK;AAE3B,kCAAS,KAAK,WAAW,QAAQ;AAEjC,+BAAM,KAAK,WAAW,KAAK;AAAA;AAC/B;;;
|
|
4
|
+
"sourcesContent": ["/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { CodeRange } from '@amazon/vinyl-util'\nimport { parseStackLocation } from '@amazon/vinyl-util'\nimport type { MockEventTarget } from '@amazon/vinyl-util/browserTestUtil'\nimport {\n MockErrorEvent,\n MockPromiseRejectionEvent,\n} from '@amazon/vinyl-util/browserTestUtil'\n\n/**\n * Creates a code range object surrounding the given error.\n */\nexport function createRangeSurrounding(error: Error): CodeRange {\n const location = parseStackLocation(error.stack)\n if (!location) {\n pending('Cannot parse stacks in this environment.')\n return { start: null, end: null }\n }\n return {\n start: {\n source: location.source,\n file: location.file,\n row: location.row,\n col: (location.col ?? 0) - 1,\n },\n end: {\n source: location.source,\n file: location.file,\n row: location.row,\n col: (location.col ?? 0) + 1,\n },\n }\n}\n\n/**\n * Simulates an uncaught error event.\n */\nexport function throwMockError(target: MockEventTarget, error: any) {\n expect(target.removeEventListener).not.toHaveBeenCalled()\n const event = new MockErrorEvent()\n event.type = 'error'\n event.error = error\n target.dispatchEvent(event)\n}\n\n/**\n * Simulates an unhandled rejection to be caught by the global unhandled promise handler.\n */\nexport function rejectMockPromise(target: MockEventTarget, reason: any) {\n expect(target.removeEventListener).not.toHaveBeenCalled()\n // Not all environments can construct `PromiseRejectionEvent`\n const event = new MockPromiseRejectionEvent()\n event.type = 'unhandledrejection'\n event.reason = reason\n event.promise = Promise.reject(reason as Error).catch(() => void 0)\n target.dispatchEvent(event)\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { GlobalRef } from '@amazon/vinyl-util'\n\nexport function overrideGlobalInit<T, U extends T>(\n initHandle: GlobalRef<T>,\n initOverride: () => U\n): { readonly value: U } {\n beforeEach(() => {\n initHandle.set(initOverride)\n })\n return initHandle as GlobalRef<U>\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { LogTarget } from '@amazon/vinyl-util'\n\nexport const emptyLogTarget: LogTarget = {\n logPrefix: 'path',\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { EventHostImpl } from '@amazon/vinyl-util'\nimport type { SpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\n/**\n * MockEventHost creates spies with pass-through calls to the EventHost implementation.\n * While this is not a true mock, events become easier to test when using a real event dispatcher.\n */\nexport class MockEventHost<EventMap = any> extends EventHostImpl<EventMap> {\n private readonly spyFactory: SpyFactory<EventHostImpl<EventMap>> =\n createSpyFactory((key) => {\n return super[key].bind(this)\n })\n\n logPrefix = 'MockEventHost'\n hasAnyListeners = this.spyFactory('hasAnyListeners')\n hasListeners = this.spyFactory('hasListeners')\n dispatch = this.spyFactory('dispatch')\n on = this.spyFactory('on')\n dispose = this.spyFactory('dispose')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { LogEventMap, Logger, LogTarget } from '@amazon/vinyl-util'\nimport { loggerRef, LogLevel } from '@amazon/vinyl-util'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { overrideGlobalInit } from '../../global/overrideGlobalInit'\nimport { MockEventHost } from '../event/MockEventHost'\nimport createSpy = jasmine.createSpy\n\ntype LogFilterFun = (target: LogTarget, ...messages: any[]) => void\n\nconst spyFactory = createSpyFactory<Logger>()\nexport class MockLogger extends MockEventHost<LogEventMap> implements Logger {\n logLevel: LogLevel = LogLevel.DEBUG\n\n log = spyFactory('log').and.callFake((target, level, ...messages) => {\n switch (level) {\n // Delegates logs to spies separated by log level.\n case LogLevel.VERBOSE:\n this.verbose(target, ...messages)\n break\n case LogLevel.DEBUG:\n this.debug(target, ...messages)\n break\n case LogLevel.INFO:\n this.info(target, ...messages)\n break\n case LogLevel.WARN:\n this.warn(target, ...messages)\n break\n case LogLevel.ERROR:\n this.error(target, ...messages)\n break\n }\n })\n\n verbose = createSpy<LogFilterFun>('verbose')\n debug = createSpy<LogFilterFun>('debug')\n info = createSpy<LogFilterFun>('info')\n warn = createSpy<LogFilterFun>('warn')\n error = createSpy<LogFilterFun>('error')\n}\n\nexport function useMockLogger(): { readonly value: MockLogger } {\n return overrideGlobalInit(loggerRef, () => new MockLogger())\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { MockNavigator } from '@amazon/vinyl-util/browserTestUtil'\nimport { spyOnPropertySafe } from '../util/spyOnPropertySafe'\n\n/**\n * Sets the global navigator to a Mock\n * Returns the new MockNavigator instance.\n */\nexport function setMockNavigator(): MockNavigator {\n const navigator = new MockNavigator()\n spyOnPropertySafe(global, 'navigator').and.returnValue(navigator)\n return navigator\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * A wrapper to jasmine spyOnProperty for property getters that will define property\n * if it doesn't exist.\n */\nexport function spyOnPropertySafe<\n T extends object,\n K extends keyof T = keyof T,\n>(object: T, property: K): jasmine.Spy<(this: T) => T[K]> {\n if (!(property in object)) {\n // Object does not have property attempting to be mocked\n // define it (with an undefined value) to allow spyOnProperty to succeed.\n Object.defineProperty(object, property, {\n configurable: true,\n enumerable: true,\n get: () => undefined,\n })\n }\n return spyOnProperty(object, property, 'get')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n//-------------------------------------------------------------\n// Empty FetchCompletedInfo objects for tests.\n//-------------------------------------------------------------\n\nimport {\n ErrorBodyType,\n type FetchRequestInfo,\n type RequestAttemptInfo,\n type RequestCaughtErrorEvent,\n type RequestNetworkErrorEvent,\n type RequestResponseErrorEvent,\n type RequestSuccessEvent,\n type ResponseInfo,\n} from '@amazon/vinyl-util'\nimport { RequestFailureType } from '@amazon/vinyl-util'\n\nexport const emptyRequestInfo: FetchRequestInfo = {\n requestId: '',\n requestOptions: { readErrorBody: ErrorBodyType.DISABLED, serviceId: null },\n init: {},\n input: '',\n maxRetries: 0,\n timestamp: 0,\n}\n\nexport const emptyRequestAttemptInfo: RequestAttemptInfo = {\n currentTry: 0,\n timestamp: 0,\n}\n\nexport const emptyResponseInfo: ResponseInfo = {\n ok: false,\n redirected: false,\n status: 0,\n statusText: '',\n type: 'default',\n url: '',\n contentLength: 0,\n}\n\nexport const emptyRequestSuccessEvent: RequestSuccessEvent = {\n ok: true,\n requestInfo: emptyRequestInfo,\n timestamp: 0,\n attemptInfo: emptyRequestAttemptInfo,\n responseInfo: emptyResponseInfo,\n}\n\nexport const emptyInternalError: RequestCaughtErrorEvent = {\n ok: false,\n reason: null,\n requestInfo: emptyRequestInfo,\n retryAfter: null,\n timestamp: 0,\n type: RequestFailureType.INTERNAL,\n willRetry: false,\n}\n\nexport const emptyNetworkError: RequestNetworkErrorEvent = {\n ok: false,\n reason: null,\n requestInfo: emptyRequestInfo,\n retryAfter: null,\n timestamp: 0,\n type: RequestFailureType.NETWORK,\n willRetry: false,\n attemptInfo: emptyRequestAttemptInfo,\n}\n\nexport const emptyResponseError: RequestResponseErrorEvent = {\n ok: false,\n reason: null,\n requestInfo: emptyRequestInfo,\n retryAfter: null,\n timestamp: 0,\n type: RequestFailureType.RESPONSE,\n willRetry: false,\n attemptInfo: emptyRequestAttemptInfo,\n responseInfo: emptyResponseInfo,\n}\n\nexport const emptyAbortError: RequestCaughtErrorEvent = {\n ...emptyInternalError,\n type: RequestFailureType.ABORT,\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {\n NetworkInformation,\n NetworkInformationEffectiveType,\n NetworkInformationType,\n} from '@amazon/vinyl-util'\nimport { MockEventTarget } from '@amazon/vinyl-util/browserTestUtil'\n\nexport class MockNetworkInformation\n extends MockEventTarget\n implements NetworkInformation\n{\n downlink: number | undefined = undefined\n effectiveType: NetworkInformationEffectiveType = '4g'\n rtt = 0\n saveData = false\n type?: NetworkInformationType = undefined\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {\n NetworkMetrics,\n NetworkMetricsController,\n NetworkMetricsEventMap,\n} from '@amazon/vinyl-util'\nimport { EMPTY_NETWORK_METRICS } from '@amazon/vinyl-util'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\n\nimport { MockEventHost } from '../event/MockEventHost'\n\nconst spyFactory = createSpyFactory<NetworkMetricsController>()\nexport class MockNetworkMetricsController\n extends MockEventHost<NetworkMetricsEventMap>\n implements NetworkMetricsController\n{\n maxHistorySize = 0\n\n metrics: NetworkMetrics = EMPTY_NETWORK_METRICS\n\n addMetricsEntry = spyFactory('addMetricsEntry')\n\n getServiceMetrics = spyFactory('getServiceMetrics')\n\n addDownlinkTransferEntry = spyFactory('addDownlinkTransferEntry')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { NetworkState, NetworkStateEventMap } from '@amazon/vinyl-util'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { MockEventHost } from '../event/MockEventHost'\n\nconst spyFactory = createSpyFactory<NetworkState>()\nexport class MockNetworkState\n extends MockEventHost<NetworkStateEventMap>\n implements NetworkState\n{\n onLine = false\n\n nextOnLine = spyFactory('nextOnLine')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Requester, RequesterImplEventMap } from '@amazon/vinyl-util'\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport { MockEventHost } from '../event/MockEventHost'\n\nconst spyFactory = createSpyFactory<Requester>()\nexport class MockRequester\n extends MockEventHost<RequesterImplEventMap>\n implements Requester\n{\n request = spyFactory('request')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { createSpyFactory } from '@amazon/vinyl-util/browserTestUtil'\nimport type { KeyValuePersistence } from '@amazon/vinyl-util'\n\nexport class MockPersistence<T = any> implements KeyValuePersistence<T> {\n private readonly spyFactory = createSpyFactory<KeyValuePersistence<T>>()\n\n clear = this.spyFactory('clear')\n\n get = this.spyFactory('get')\n\n remove = this.spyFactory('remove')\n\n set = this.spyFactory('set')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport CustomReporter = jasmine.CustomReporter\nimport JasmineDoneInfo = jasmine.JasmineDoneInfo\nimport JasmineStartedInfo = jasmine.JasmineStartedInfo\nimport SpecResult = jasmine.SpecResult\nimport SuiteResult = jasmine.SuiteResult\nimport { LogLevel, type ReadonlyDate } from '@amazon/vinyl-util'\n\n/**\n * The minimum number of seconds between progress reports.\n */\nconst UPDATE_INTERVAL = 1\n\n/**\n * The maximum number of log statements before forcing a flush.\n * This can be reached if a single test is long-running and has excessive logs.\n */\nconst MAX_LOGS_BUFFER = 200\n\nexport interface LogReporterStartedEvent {\n readonly totalSpecs: number\n}\n\nexport interface LogReporterProgressEvent {\n readonly totalCompleted: number\n readonly totalSpecs: number\n readonly logs: readonly LogEntry[]\n}\n\nexport interface LogReporterDoneEvent {\n readonly overallStatus: 'passed' | 'failed'\n readonly totalCompleted: number\n readonly totalSpecs: number\n readonly reason: string\n\n /**\n * The number of specs completed with each status.\n */\n readonly statusCounts: Readonly<Record<string, number>>\n\n /**\n * Every failed spec and suite, and failures outside any suite (named 'top level').\n */\n readonly failures: readonly LogReporterFailure[]\n\n /**\n * The seed of the randomized spec order, to reproduce the run with `?seed=`.\n */\n readonly seed: string\n}\n\nexport interface LogReporterFailure {\n readonly fullName: string\n readonly messages: readonly string[]\n}\n\nexport interface LogEntry {\n readonly timestamp: ReadonlyDate\n readonly messages: readonly any[]\n readonly level: LogLevel\n}\n\nexport abstract class LogReporter implements CustomReporter {\n /**\n * The first failed spec.\n *\n * Jasmine's spec result in `jasmineDone` does not provide these correctly in\n * failedExpectations, save this from `specDone`.\n */\n private failedResult: SpecResult | null = null\n\n private readonly failures: LogReporterFailure[] = []\n private readonly statusCounts: Record<string, number> = {}\n\n private totalSpecs = 0\n private totalCompleted = 0\n\n /**\n * The timestamp of the last progress update.\n */\n protected lastProgressTimestamp = 0\n protected updateInterval = UPDATE_INTERVAL\n protected maxLogsBuffer = MAX_LOGS_BUFFER\n\n private consoleInterceptor = new ConsoleInterceptor()\n\n private readonly logs: LogEntry[] = []\n\n protected constructor() {\n this.consoleInterceptor.onLog = (entry) => {\n this.logs.push(entry)\n if (this.logs.length >= this.maxLogsBuffer)\n this.maybeReportProgress(true)\n }\n }\n\n jasmineStarted(suiteInfo: JasmineStartedInfo): void {\n this.onStarted({\n totalSpecs: suiteInfo.totalSpecsDefined,\n }).catch((e) => {\n console.error(`'done' failed to report`, e)\n })\n this.totalCompleted = 0\n this.totalSpecs = suiteInfo.totalSpecsDefined\n }\n\n protected abstract onStarted(action: LogReporterStartedEvent): Promise<void>\n\n specStarted(result: SpecResult): void {\n // Log the running spec and flush immediately. A spec that hangs never\n // reaches specDone, so without this the buffered logs \u2014 and which spec\n // was running \u2014 never reach the reporter and the log just cuts off. The\n // forced flush makes the last logged spec name identify the culprit.\n console.info(`Running spec: ${result.fullName}`)\n this.maybeReportProgress()\n }\n\n specDone(result: SpecResult): void {\n if (result.status === 'failed') {\n this.failedResult ??= result\n this.addFailure(result.fullName, result.failedExpectations)\n }\n this.statusCounts[result.status] =\n (this.statusCounts[result.status] ?? 0) + 1\n this.totalCompleted++\n this.maybeReportProgress()\n }\n\n suiteDone(result: SuiteResult): void {\n if (result.failedExpectations.length)\n this.addFailure(result.fullName, result.failedExpectations)\n }\n\n private addFailure(\n fullName: string,\n failedExpectations: readonly { readonly message: string }[]\n ) {\n this.failures.push({\n fullName,\n messages: failedExpectations.map((e) => e.message),\n })\n }\n\n jasmineDone(runDetails: JasmineDoneInfo): void {\n if (runDetails.failedExpectations.length)\n this.addFailure('top level', runDetails.failedExpectations)\n this.maybeReportProgress(true)\n this.consoleInterceptor.dispose()\n const reason = this.failedResult\n ? `${this.failedResult.fullName}:\\n${this.failedResult.failedExpectations[0]?.message}`\n : runDetails.overallStatus === 'incomplete'\n ? runDetails.incompleteReason\n : ''\n const body: LogReporterDoneEvent = {\n // one of: 'passed', 'failed', 'incomplete'\n overallStatus:\n runDetails.overallStatus === 'incomplete'\n ? 'passed'\n : (runDetails.overallStatus as 'passed' | 'failed'),\n totalCompleted: this.totalCompleted,\n totalSpecs: this.totalSpecs,\n reason,\n statusCounts: this.statusCounts,\n failures: this.failures,\n seed: String(runDetails.order.seed),\n }\n this.onDone(body).catch((_) => {\n // One retry:\n this.onDone(body).catch((e) => {\n console.error(`'done' failed to report`, e)\n })\n })\n }\n\n /**\n * If there has not been a progress update within `updateInterval`, emit another progress\n * event.\n * @private\n */\n private maybeReportProgress(force: boolean = false) {\n const now = Date.now()\n if (\n force ||\n now - this.lastProgressTimestamp > this.updateInterval * 1000\n ) {\n const logs = this.logs.slice()\n this.logs.length = 0\n this.onProgress({\n totalCompleted: this.totalCompleted,\n totalSpecs: this.totalSpecs,\n logs,\n }).catch((e) => {\n console.error(`'progress' failed to report`, e)\n })\n this.lastProgressTimestamp = now\n }\n }\n\n protected abstract onProgress(\n action: LogReporterProgressEvent\n ): Promise<void>\n\n protected abstract onDone(action: LogReporterDoneEvent): Promise<void>\n}\n\nconst consoleMethods = [\n 'debug',\n 'log',\n 'info',\n 'warn',\n 'error',\n] as const satisfies (keyof Console)[]\n\nconst consoleMethodLevels: Record<string, LogLevel> = {\n debug: LogLevel.DEBUG,\n log: LogLevel.DEBUG,\n warn: LogLevel.WARN,\n info: LogLevel.INFO,\n error: LogLevel.ERROR,\n} as const\n\n/**\n * Intercepts console, logging to an array as well.\n */\nclass ConsoleInterceptor {\n private readonly originalMethods: Record<string, (...args: any[]) => void>\n\n /**\n * Invoked on every log statement.\n */\n onLog: ((entry: LogEntry) => void) | null = null\n\n constructor() {\n this.originalMethods = {}\n for (const consoleMethod of consoleMethods) {\n this.originalMethods[consoleMethod] = console[consoleMethod]\n console[consoleMethod] = (...args) => {\n if (this.onLog)\n this.onLog({\n level:\n consoleMethodLevels[consoleMethod] ??\n LogLevel.DEBUG,\n timestamp: new Date(),\n messages: args,\n })\n this.originalMethods[consoleMethod].apply(console, args)\n }\n }\n }\n\n dispose() {\n for (const consoleMethod of consoleMethods) {\n console[consoleMethod] = this.originalMethods[consoleMethod]\n }\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nlet loggingUncaughtErrors = false\n\n/**\n * Logs uncaught errors and promise rejections to the console, to be emitted to the report api.\n * Jasmine catches uncaught errors and only reports the message in the test failure, not the whole error event.\n */\nexport function initializeUncaughtErrorLogging() {\n if (loggingUncaughtErrors) return\n loggingUncaughtErrors = true\n window.addEventListener('error', (event) => {\n console.error('uncaught error event:', event)\n })\n\n window.addEventListener('unhandledrejection', (event) => {\n console.error('unhandled rejection:', event)\n })\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n type LogReporterProgressEvent,\n LogReporter,\n type LogReporterDoneEvent,\n type LogReporterStartedEvent,\n} from './LogReporter'\nimport { initializeUncaughtErrorLogging } from '../util/initializeUncaughtErrorLogging'\nimport { stringifyLogLevel } from '@amazon/vinyl-util'\n\nexport class RestApiReporter extends LogReporter {\n /**\n * Installs this reporter if this is a Browser environment and the report api has been provided as a query\n * parameter.\n * @param searchParam\n */\n static installFromSearchParam(searchParam: string = 'reportApi') {\n if (typeof location === 'undefined') return\n const url = new URL('about:blank')\n url.search = location.search\n // Uses `URL.searchParams` over `new URLSearchParams`; URLSearchParams constructor is not\n // as widely supported.\n const reportApi = url.searchParams.get(searchParam)\n if (reportApi) {\n jasmine.getEnv().addReporter(new RestApiReporter(reportApi))\n initializeUncaughtErrorLogging()\n }\n }\n\n constructor(private readonly reportApi: string) {\n super()\n }\n\n protected onStarted(action: LogReporterStartedEvent): Promise<void> {\n return this.doRequest('started', action)\n }\n\n protected onProgress(action: LogReporterProgressEvent): Promise<void> {\n return this.doRequest('progress', {\n totalCompleted: action.totalCompleted,\n totalSpecs: action.totalSpecs,\n logs: action.logs.map((logEntry) => [\n stringifyLogLevel(logEntry.level),\n logEntry.timestamp.toISOString(),\n logArgsToStr(logEntry.messages),\n ]),\n })\n }\n\n protected onDone(action: LogReporterDoneEvent): Promise<void> {\n return this.doRequest('done', action)\n }\n\n /**\n * If the reportApi url was set in the URL parameters, report to that URL the test progress.\n *\n * @param action One of: 'started', 'progress', or 'done'\n * @param body\n * @private\n */\n private async doRequest(\n action: 'started' | 'progress' | 'done',\n body: any\n ): Promise<void> {\n if (!this.reportApi) return\n const response = await fetch(`${this.reportApi}/${action}`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(body),\n })\n if (!response.ok)\n throw new Error(`${response.status} Error: ${response.statusText}`)\n return await response.json()\n }\n}\n\n/**\n * Converts the arguments to console logging to a string.\n * @param args\n */\nfunction logArgsToStr(args: readonly any[]): string {\n return args\n .map((arg) => {\n if (arg != null && typeof arg === 'object') {\n try {\n return JSON.stringify(arg)\n } catch (_) {\n return String(arg)\n }\n } else {\n return String(arg)\n }\n })\n .join(' ')\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {\n Disposable,\n EventHandler,\n Fun,\n ReadonlyEventHost,\n} from '@amazon/vinyl-util'\nimport { Abort, Deferred, substitute, timeout } from '@amazon/vinyl-util'\nimport createSpy = jasmine.createSpy\nimport Spy = jasmine.Spy\n\n/**\n * A Spy that provides a way to promisify the next call and unsubscribe.\n *\n * Do not use `and` on an EventSpy, the callFake is used to provide the next promise.\n */\nexport interface EventSpy<EventMap, K extends keyof EventMap>\n extends Spy<EventHandler<EventMap[K]>>, Fun, Disposable {\n /**\n * Returns a promise that resolves when the event has next been dispatched, or rejects\n * if timeout has elapsed.\n *\n * @param timeout The number of seconds before a timeout.\n * @param timeoutMessage An optional timeout message to use instead of the default.\n * This may use two tokens:\n * {0} - The event type.\n * {1} - Number of seconds before the timeout.\n */\n next(timeout?: number, timeoutMessage?: string): Promise<EventMap[K]>\n}\n\n/**\n * The timeouts of pending `next` calls. A timeout outliving its spec, for example when the spec failed before\n * awaiting it, would otherwise reject during and fail a later spec.\n */\nconst pendingTimeouts = new Set<Abort>()\n\nif (typeof afterEach === 'function')\n afterEach(() => {\n for (const abort of pendingTimeouts) abort.abort()\n pendingTimeouts.clear()\n })\n\n/**\n * Adds a listener to an event host, returning a spy for assertions.\n *\n * The returned spy provides a `next` function to promisify the next call and a `dispose` function\n * to unsubscribe.\n *\n * @param host\n * @param type\n */\nexport function createEventSpy<EventMap, K extends keyof EventMap>(\n host: ReadonlyEventHost<EventMap>,\n type: K\n): EventSpy<EventMap, K> {\n const spy = createSpy(String(type))\n let nextCall = new Deferred<EventMap[K]>()\n spy.and.callFake(() => {\n nextCall.resolve(spy.calls.mostRecent().args[0])\n nextCall = new Deferred<EventMap[K]>()\n })\n const unsub = host.on(type, spy)\n\n return Object.assign(spy, {\n next(\n time = 5,\n timeoutMessage = `event '{type}' has not been dispatched after {timeout}s.`\n ) {\n const call = nextCall\n const abort = new Abort()\n pendingTimeouts.add(abort)\n const settle = () => {\n abort.abort()\n pendingTimeouts.delete(abort)\n }\n return Promise.race([\n call,\n timeout(time, {\n abort,\n message: substitute(timeoutMessage, {\n type,\n timeout: time,\n }),\n }),\n ])\n .then(() => {\n settle()\n return call\n })\n .catch((error: unknown) => {\n settle()\n throw error\n })\n },\n dispose: unsub,\n })\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAMA,SAAS,0BAA0B;AAEnC;AAAA,EACI;AAAA,EACA;AAAA,OACG;AAKA,SAAS,uBAAuB,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,KAAK,MAAM;AACR,eAAO;AACP,eAAO;AAAA,MACX,CAAC,EACA,MAAM,CAAC,UAAmB;AACvB,eAAO;AACP,cAAM;AAAA,MACV,CAAC;AAAA,IACT;AAAA,IACA,SAAS;AAAA,EACb,CAAC;AACL;",
|
|
6
6
|
"names": ["location", "createSpyFactory", "createSpyFactory", "createSpyFactory", "spyFactory", "createSpyFactory", "createSpyFactory", "spyFactory", "createSpyFactory", "createSpyFactory", "spyFactory", "createSpyFactory", "createSpyFactory", "createSpyFactory", "LogLevel", "LogLevel", "createSpy"]
|
|
7
7
|
}
|
|
@@ -2,6 +2,7 @@ import CustomReporter = jasmine.CustomReporter;
|
|
|
2
2
|
import JasmineDoneInfo = jasmine.JasmineDoneInfo;
|
|
3
3
|
import JasmineStartedInfo = jasmine.JasmineStartedInfo;
|
|
4
4
|
import SpecResult = jasmine.SpecResult;
|
|
5
|
+
import SuiteResult = jasmine.SuiteResult;
|
|
5
6
|
import { LogLevel, type ReadonlyDate } from '@amazon/vinyl-util';
|
|
6
7
|
export interface LogReporterStartedEvent {
|
|
7
8
|
readonly totalSpecs: number;
|
|
@@ -16,6 +17,22 @@ export interface LogReporterDoneEvent {
|
|
|
16
17
|
readonly totalCompleted: number;
|
|
17
18
|
readonly totalSpecs: number;
|
|
18
19
|
readonly reason: string;
|
|
20
|
+
/**
|
|
21
|
+
* The number of specs completed with each status.
|
|
22
|
+
*/
|
|
23
|
+
readonly statusCounts: Readonly<Record<string, number>>;
|
|
24
|
+
/**
|
|
25
|
+
* Every failed spec and suite, and failures outside any suite (named 'top level').
|
|
26
|
+
*/
|
|
27
|
+
readonly failures: readonly LogReporterFailure[];
|
|
28
|
+
/**
|
|
29
|
+
* The seed of the randomized spec order, to reproduce the run with `?seed=`.
|
|
30
|
+
*/
|
|
31
|
+
readonly seed: string;
|
|
32
|
+
}
|
|
33
|
+
export interface LogReporterFailure {
|
|
34
|
+
readonly fullName: string;
|
|
35
|
+
readonly messages: readonly string[];
|
|
19
36
|
}
|
|
20
37
|
export interface LogEntry {
|
|
21
38
|
readonly timestamp: ReadonlyDate;
|
|
@@ -30,6 +47,8 @@ export declare abstract class LogReporter implements CustomReporter {
|
|
|
30
47
|
* failedExpectations, save this from `specDone`.
|
|
31
48
|
*/
|
|
32
49
|
private failedResult;
|
|
50
|
+
private readonly failures;
|
|
51
|
+
private readonly statusCounts;
|
|
33
52
|
private totalSpecs;
|
|
34
53
|
private totalCompleted;
|
|
35
54
|
/**
|
|
@@ -45,6 +64,8 @@ export declare abstract class LogReporter implements CustomReporter {
|
|
|
45
64
|
protected abstract onStarted(action: LogReporterStartedEvent): Promise<void>;
|
|
46
65
|
specStarted(result: SpecResult): void;
|
|
47
66
|
specDone(result: SpecResult): void;
|
|
67
|
+
suiteDone(result: SuiteResult): void;
|
|
68
|
+
private addFailure;
|
|
48
69
|
jasmineDone(runDetails: JasmineDoneInfo): void;
|
|
49
70
|
/**
|
|
50
71
|
* If there has not been a progress update within `updateInterval`, emit another progress
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogReporter.d.ts","sourceRoot":"","sources":["../../../../../test/testUtil/reporters/LogReporter.ts"],"names":[],"mappings":"AAKA,OAAO,cAAc,GAAG,OAAO,CAAC,cAAc,CAAA;AAC9C,OAAO,eAAe,GAAG,OAAO,CAAC,eAAe,CAAA;AAChD,OAAO,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAA;AACtD,OAAO,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAahE,MAAM,WAAW,uBAAuB;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC9B;AAED,MAAM,WAAW,wBAAwB;IACrC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,IAAI,EAAE,SAAS,QAA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AAG,IAAI;IA+B9C;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAmB3B,SAAS,CAAC,QAAQ,CAAC,UAAU,CACzB,MAAM,EAAE,wBAAwB,GACjC,OAAO,CAAC,IAAI,CAAC;IAEhB,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;CACzE"}
|
|
@@ -20,6 +20,8 @@ export class LogReporter {
|
|
|
20
20
|
* failedExpectations, save this from `specDone`.
|
|
21
21
|
*/
|
|
22
22
|
failedResult = null;
|
|
23
|
+
failures = [];
|
|
24
|
+
statusCounts = {};
|
|
23
25
|
totalSpecs = 0;
|
|
24
26
|
totalCompleted = 0;
|
|
25
27
|
/**
|
|
@@ -55,12 +57,28 @@ export class LogReporter {
|
|
|
55
57
|
this.maybeReportProgress();
|
|
56
58
|
}
|
|
57
59
|
specDone(result) {
|
|
58
|
-
if (
|
|
59
|
-
this.failedResult
|
|
60
|
+
if (result.status === 'failed') {
|
|
61
|
+
this.failedResult ??= result;
|
|
62
|
+
this.addFailure(result.fullName, result.failedExpectations);
|
|
63
|
+
}
|
|
64
|
+
this.statusCounts[result.status] =
|
|
65
|
+
(this.statusCounts[result.status] ?? 0) + 1;
|
|
60
66
|
this.totalCompleted++;
|
|
61
67
|
this.maybeReportProgress();
|
|
62
68
|
}
|
|
69
|
+
suiteDone(result) {
|
|
70
|
+
if (result.failedExpectations.length)
|
|
71
|
+
this.addFailure(result.fullName, result.failedExpectations);
|
|
72
|
+
}
|
|
73
|
+
addFailure(fullName, failedExpectations) {
|
|
74
|
+
this.failures.push({
|
|
75
|
+
fullName,
|
|
76
|
+
messages: failedExpectations.map((e) => e.message),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
63
79
|
jasmineDone(runDetails) {
|
|
80
|
+
if (runDetails.failedExpectations.length)
|
|
81
|
+
this.addFailure('top level', runDetails.failedExpectations);
|
|
64
82
|
this.maybeReportProgress(true);
|
|
65
83
|
this.consoleInterceptor.dispose();
|
|
66
84
|
const reason = this.failedResult
|
|
@@ -76,6 +94,9 @@ export class LogReporter {
|
|
|
76
94
|
totalCompleted: this.totalCompleted,
|
|
77
95
|
totalSpecs: this.totalSpecs,
|
|
78
96
|
reason,
|
|
97
|
+
statusCounts: this.statusCounts,
|
|
98
|
+
failures: this.failures,
|
|
99
|
+
seed: String(runDetails.order.seed),
|
|
79
100
|
};
|
|
80
101
|
this.onDone(body).catch((_) => {
|
|
81
102
|
// One retry:
|