@empiricalrun/playwright-utils 0.28.7 → 0.29.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/config/index.d.ts.map +1 -1
  3. package/dist/config/index.js +1 -6
  4. package/dist/playwright-extensions.d.ts.map +1 -1
  5. package/dist/reporter/empirical-reporter.d.ts +1 -1
  6. package/dist/reporter/empirical-reporter.d.ts.map +1 -1
  7. package/dist/reporter/empirical-reporter.js +38 -38
  8. package/dist/reporter/uploader.d.ts +1 -12
  9. package/dist/reporter/uploader.d.ts.map +1 -1
  10. package/dist/reporter/uploader.js +0 -42
  11. package/dist/reporter/util.d.ts +3 -21
  12. package/dist/reporter/util.d.ts.map +1 -1
  13. package/dist/reporter/util.js +0 -17
  14. package/package.json +6 -6
  15. package/playwright.config.ts +7 -4
  16. package/tsconfig.tsbuildinfo +1 -1
  17. package/dist/reporter/base.d.ts +0 -41
  18. package/dist/reporter/base.d.ts.map +0 -1
  19. package/dist/reporter/base.js +0 -177
  20. package/dist/reporter/custom.d.ts +0 -72
  21. package/dist/reporter/custom.d.ts.map +0 -1
  22. package/dist/reporter/custom.js +0 -824
  23. package/dist/reporter/queue.d.ts +0 -8
  24. package/dist/reporter/queue.d.ts.map +0 -1
  25. package/dist/reporter/queue.js +0 -88
  26. package/dist/reporter/reporterV2.d.ts +0 -36
  27. package/dist/reporter/reporterV2.d.ts.map +0 -1
  28. package/dist/reporter/reporterV2.js +0 -19
  29. package/dist/reporter/third_party/html-reporter-types.d.ts +0 -107
  30. package/dist/reporter/third_party/html-reporter-types.d.ts.map +0 -1
  31. package/dist/reporter/third_party/html-reporter-types.js +0 -18
  32. package/dist/reporter/types.d.ts +0 -3
  33. package/dist/reporter/types.d.ts.map +0 -1
  34. package/dist/reporter/types.js +0 -2
  35. package/eslint.config.mjs +0 -23
@@ -1,8 +0,0 @@
1
- import { FileMap } from "@empiricalrun/r2-uploader";
2
- export type AsyncTask = () => Promise<FileMap | void>;
3
- type AsyncTaskReturnType = FileMap | void;
4
- type AsyncTaskResult = Promise<AsyncTaskReturnType>;
5
- export declare function sendTaskToQueue(task: AsyncTask): AsyncTaskResult;
6
- export declare function waitForTaskQueueToFinish(): Promise<void>;
7
- export {};
8
- //# sourceMappingURL=queue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/reporter/queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAIpD,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;AACtD,KAAK,mBAAmB,GAAG,OAAO,GAAG,IAAI,CAAC;AAC1C,KAAK,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAoGpD,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,eAAe,CAQhE;AAED,wBAAgB,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC,CAOxD"}
@@ -1,88 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sendTaskToQueue = sendTaskToQueue;
4
- exports.waitForTaskQueueToFinish = waitForTaskQueueToFinish;
5
- const logger_1 = require("../logger");
6
- class TaskQueue {
7
- waitingQueue = [];
8
- executingTasks = [];
9
- maxConcurrent;
10
- constructor() {
11
- this.maxConcurrent = process.env.UPLOAD_MAX_QUEUE_SIZE
12
- ? parseInt(process.env.UPLOAD_MAX_QUEUE_SIZE)
13
- : 2;
14
- }
15
- async processNextTask() {
16
- logger_1.logger.debug("[queue] processing next task in queue, with queue lengths:", taskQueue.queueLength, taskQueue.executingTasksCount);
17
- if (this.waitingQueue.length === 0 ||
18
- this.executingTasks.length >= this.maxConcurrent) {
19
- return;
20
- }
21
- const queuedTask = this.waitingQueue.shift();
22
- if (!queuedTask)
23
- return;
24
- const { task, resolve, reject } = queuedTask;
25
- // Create the promise first
26
- let executingPromise;
27
- const executeTask = async () => {
28
- try {
29
- const result = await task();
30
- resolve(result);
31
- }
32
- catch (error) {
33
- logger_1.logger.error("Error in processing task", error);
34
- reject(error);
35
- }
36
- finally {
37
- // Remove this task from executing tasks
38
- const index = this.executingTasks.indexOf(executingPromise);
39
- if (index > -1) {
40
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
41
- this.executingTasks.splice(index, 1);
42
- }
43
- // Try to process next task
44
- await this.processNextTask();
45
- }
46
- };
47
- // Assign the promise
48
- executingPromise = executeTask();
49
- this.executingTasks.push(executingPromise);
50
- }
51
- enqueue(task) {
52
- return new Promise((resolve, reject) => {
53
- this.waitingQueue.push({ task, resolve, reject });
54
- this.processNextTask().catch((error) => {
55
- logger_1.logger.error("Error processing queue", error);
56
- });
57
- });
58
- }
59
- async waitForCompletion() {
60
- if (this.waitingQueue.length === 0 && this.executingTasks.length === 0) {
61
- return;
62
- }
63
- // First wait for all currently executing tasks
64
- if (this.executingTasks.length > 0) {
65
- await Promise.all(this.executingTasks);
66
- }
67
- // If there are still tasks in the waiting queue, process them
68
- if (this.waitingQueue.length > 0) {
69
- await this.processNextTask();
70
- }
71
- await this.waitForCompletion();
72
- }
73
- get queueLength() {
74
- return this.waitingQueue.length;
75
- }
76
- get executingTasksCount() {
77
- return this.executingTasks.length;
78
- }
79
- }
80
- const taskQueue = new TaskQueue();
81
- function sendTaskToQueue(task) {
82
- logger_1.logger.debug("[queue] sending task to queue, with queue lengths:", taskQueue.queueLength, taskQueue.executingTasksCount, task);
83
- return taskQueue.enqueue(task);
84
- }
85
- function waitForTaskQueueToFinish() {
86
- logger_1.logger.debug("[queue] waiting for queue to finish, with queue lengths:", taskQueue.queueLength, taskQueue.executingTasksCount);
87
- return taskQueue.waitForCompletion();
88
- }
@@ -1,36 +0,0 @@
1
- /**
2
- * Original file: https://github.com/microsoft/playwright/blob/cf8c14f884b6f24966350a5f49b1580c3e183d21/packages/playwright/src/reporters/reporterV2.ts
3
- * Copyright (c) Microsoft Corporation.
4
- * Modifications copyright (c) Forge AI Private Limited
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
- import type { FullConfig, FullResult, Suite, TestCase, TestError, TestResult, TestStep } from "@playwright/test/reporter";
19
- export interface ReporterV2 {
20
- onConfigure(config: FullConfig): void;
21
- onBegin(suite: Suite): void;
22
- onTestBegin(test: TestCase, result: TestResult): void;
23
- onStdOut(chunk: string | Buffer, test?: TestCase, result?: TestResult): void;
24
- onStdErr(chunk: string | Buffer, test?: TestCase, result?: TestResult): void;
25
- onTestEnd(test: TestCase, result: TestResult): void;
26
- onEnd(result: FullResult): Promise<{
27
- status?: FullResult["status"];
28
- } | undefined | void> | void;
29
- onExit(): void | Promise<void>;
30
- onError(error: TestError): void;
31
- onStepBegin(test: TestCase, result: TestResult, step: TestStep): void;
32
- onStepEnd(test: TestCase, result: TestResult, step: TestStep): void;
33
- printsToStdio(): boolean;
34
- version(): "v2";
35
- }
36
- //# sourceMappingURL=reporterV2.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reporterV2.d.ts","sourceRoot":"","sources":["../../src/reporter/reporterV2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,KAAK,EACL,QAAQ,EACR,SAAS,EACT,UAAU,EACV,QAAQ,EACT,MAAM,2BAA2B,CAAC;AAEnC,MAAM,WAAW,UAAU;IACzB,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IACtC,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC5B,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IACtD,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC7E,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC7E,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IACpD,KAAK,CACH,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC;QAAE,MAAM,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAA;KAAE,GAAG,SAAS,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IACxE,MAAM,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IAChC,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;IACtE,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;IACpE,aAAa,IAAI,OAAO,CAAC;IACzB,OAAO,IAAI,IAAI,CAAC;CACjB"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- /**
3
- * Original file: https://github.com/microsoft/playwright/blob/cf8c14f884b6f24966350a5f49b1580c3e183d21/packages/playwright/src/reporters/reporterV2.ts
4
- * Copyright (c) Microsoft Corporation.
5
- * Modifications copyright (c) Forge AI Private Limited
6
- *
7
- * Licensed under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- */
19
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,107 +0,0 @@
1
- /**
2
- * Original file: https://github.com/microsoft/playwright/blob/cf8c14f884b6f24966350a5f49b1580c3e183d21/packages/html-reporter/src/types.ts
3
- * Copyright (c) Microsoft Corporation.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- import type { Metadata } from '@playwright/test';
18
- export type Stats = {
19
- total: number;
20
- expected: number;
21
- unexpected: number;
22
- flaky: number;
23
- skipped: number;
24
- ok: boolean;
25
- };
26
- export type FilteredStats = {
27
- total: number;
28
- duration: number;
29
- };
30
- export type Location = {
31
- file: string;
32
- line: number;
33
- column: number;
34
- };
35
- export type HTMLReport = {
36
- metadata: Metadata;
37
- files: TestFileSummary[];
38
- stats: Stats;
39
- projectNames: string[];
40
- startTime: number;
41
- duration: number;
42
- errors: string[];
43
- };
44
- export type TestFile = {
45
- fileId: string;
46
- fileName: string;
47
- tests: TestCase[];
48
- };
49
- export type TestFileSummary = {
50
- fileId: string;
51
- fileName: string;
52
- tests: TestCaseSummary[];
53
- stats: Stats;
54
- };
55
- export type TestCaseAnnotation = {
56
- type: string;
57
- description?: string;
58
- };
59
- export type TestCaseSummary = {
60
- testId: string;
61
- title: string;
62
- path: string[];
63
- projectName: string;
64
- location: Location;
65
- annotations: TestCaseAnnotation[];
66
- tags: string[];
67
- outcome: 'skipped' | 'expected' | 'unexpected' | 'flaky';
68
- duration: number;
69
- ok: boolean;
70
- results: TestResultSummary[];
71
- };
72
- export type TestResultSummary = {
73
- attachments: {
74
- name: string;
75
- contentType: string;
76
- path?: string;
77
- }[];
78
- };
79
- export type TestCase = Omit<TestCaseSummary, 'results'> & {
80
- results: TestResult[];
81
- };
82
- export type TestAttachment = {
83
- name: string;
84
- body?: string;
85
- path?: string;
86
- contentType: string;
87
- };
88
- export type TestResult = {
89
- retry: number;
90
- startTime: string;
91
- duration: number;
92
- steps: TestStep[];
93
- errors: string[];
94
- attachments: TestAttachment[];
95
- status: 'passed' | 'failed' | 'timedOut' | 'skipped' | 'interrupted';
96
- };
97
- export type TestStep = {
98
- title: string;
99
- startTime: string;
100
- duration: number;
101
- location?: Location;
102
- snippet?: string;
103
- error?: string;
104
- steps: TestStep[];
105
- count: number;
106
- };
107
- //# sourceMappingURL=html-reporter-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"html-reporter-types.d.ts","sourceRoot":"","sources":["../../../src/reporter/third_party/html-reporter-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,MAAM,KAAK,GAAG;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,OAAO,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAA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/html-reporter/src/types.ts
4
- * Copyright (c) Microsoft Corporation.
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +0,0 @@
1
- import type { TestCaseRunEndEvent as SharedTestCaseRunEndEvent } from "@empiricalrun/shared-types";
2
- export type TestCaseRunEndEvent = SharedTestCaseRunEndEvent;
3
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/reporter/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,IAAI,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAEnG,MAAM,MAAM,mBAAmB,GAAG,yBAAyB,CAAC"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
package/eslint.config.mjs DELETED
@@ -1,23 +0,0 @@
1
- import libraryConfig from "../eslint-config/library.mjs";
2
- import tsParser from "@typescript-eslint/parser";
3
-
4
- export default [
5
- ...libraryConfig,
6
- {
7
- ignores: ["src/reporter/third_party/**/*"],
8
- },
9
- {
10
- files: ["src/**/*.ts", "src/**/*.tsx"],
11
- languageOptions: {
12
- parser: tsParser,
13
- globals: {
14
- node: true,
15
- browser: true,
16
- },
17
- parserOptions: {
18
- project: "./tsconfig.lint.json",
19
- tsconfigRootDir: import.meta.dirname,
20
- },
21
- },
22
- },
23
- ];