@empiricalrun/test-run 0.16.1 → 0.17.1

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 (38) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/bin/commands/run.d.ts.map +1 -1
  3. package/dist/bin/commands/run.js +13 -14
  4. package/dist/bin/index.js +0 -4
  5. package/dist/dashboard.d.ts +1 -1
  6. package/dist/dashboard.d.ts.map +1 -1
  7. package/dist/dashboard.js +4 -6
  8. package/dist/index.d.ts +0 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +1 -3
  11. package/dist/lib/cmd.d.ts.map +1 -1
  12. package/dist/lib/cmd.js +0 -36
  13. package/dist/lib/merge-reports/html.d.ts.map +1 -1
  14. package/dist/lib/merge-reports/html.js +2 -11
  15. package/dist/lib/merge-reports/index.d.ts +6 -1
  16. package/dist/lib/merge-reports/index.d.ts.map +1 -1
  17. package/dist/lib/merge-reports/index.js +85 -9
  18. package/dist/lib/merge-reports/types.d.ts +1 -1
  19. package/dist/lib/run-all-tests.d.ts.map +1 -1
  20. package/dist/lib/run-all-tests.js +11 -5
  21. package/dist/utils/index.d.ts +0 -2
  22. package/dist/utils/index.d.ts.map +1 -1
  23. package/dist/utils/index.js +1 -12
  24. package/package.json +5 -5
  25. package/tsconfig.tsbuildinfo +1 -1
  26. package/dist/bin/commands/estimate-time-shard.d.ts +0 -3
  27. package/dist/bin/commands/estimate-time-shard.d.ts.map +0 -1
  28. package/dist/bin/commands/estimate-time-shard.js +0 -122
  29. package/dist/bin/commands/optimize-shards.d.ts +0 -3
  30. package/dist/bin/commands/optimize-shards.d.ts.map +0 -1
  31. package/dist/bin/commands/optimize-shards.js +0 -544
  32. package/dist/lib/cancellation-watcher.d.ts +0 -5
  33. package/dist/lib/cancellation-watcher.d.ts.map +0 -1
  34. package/dist/lib/cancellation-watcher.js +0 -49
  35. package/test-data/blob-report/report-1.zip +0 -0
  36. package/test-data/blob-report/report-2.zip +0 -0
  37. package/test-data/expand-serial-fixture/playwright.config.ts +0 -6
  38. package/test-data/expand-serial-fixture/serial.spec.ts +0 -17
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.startCancellationWatcher = startCancellationWatcher;
4
- const DOMAIN = process.env.DASHBOARD_DOMAIN || "https://dash.empirical.run";
5
- const DEFAULT_POLL_INTERVAL_MS = 30_000;
6
- async function checkTestRunStatus(testRunId, apiKey) {
7
- const url = `${DOMAIN}/api/test-runs/${testRunId}/status`;
8
- try {
9
- const response = await fetch(url, {
10
- headers: { Authorization: `Bearer ${apiKey}` },
11
- });
12
- if (!response.ok) {
13
- console.log(`[CancellationWatcher] Failed to check status: HTTP ${response.status} from ${url}`);
14
- return { isTerminal: false, status: null };
15
- }
16
- const result = (await response.json());
17
- const status = result.data || { isTerminal: false, status: null };
18
- return status;
19
- }
20
- catch (error) {
21
- const message = error instanceof Error ? error.message : String(error);
22
- console.log(`[CancellationWatcher] Failed to check status: ${message}`);
23
- return { isTerminal: false, status: null };
24
- }
25
- }
26
- function startCancellationWatcher(testRunId, apiKey, onCancel, pollIntervalMs = DEFAULT_POLL_INTERVAL_MS) {
27
- let stopped = false;
28
- console.log(`[CancellationWatcher] Starting watcher for test run ${testRunId} (polling every ${pollIntervalMs}ms)`);
29
- console.log(`[CancellationWatcher] Dashboard domain: ${DOMAIN}`);
30
- const poll = async () => {
31
- while (!stopped) {
32
- const { status } = await checkTestRunStatus(testRunId, apiKey);
33
- if (status === "cancelling" || status === "cancelled") {
34
- console.log(`[CancellationWatcher] Test run ${testRunId} is ${status}, triggering cancellation`);
35
- onCancel();
36
- stopped = true;
37
- return;
38
- }
39
- await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
40
- }
41
- };
42
- poll();
43
- return {
44
- stop: () => {
45
- console.log(`[CancellationWatcher] Stopping watcher for ${testRunId}`);
46
- stopped = true;
47
- },
48
- };
49
- }
Binary file
Binary file
@@ -1,6 +0,0 @@
1
- import { defineConfig } from "@playwright/test";
2
-
3
- export default defineConfig({
4
- testDir: ".",
5
- projects: [{ name: "chromium" }],
6
- });
@@ -1,17 +0,0 @@
1
- import { expect, test } from "@playwright/test";
2
-
3
- test.describe("Serial Tests", () => {
4
- test.describe.configure({ mode: "serial" });
5
-
6
- test("Test 1 should pass", async () => {
7
- expect(true).toBe(true);
8
- });
9
-
10
- test("Test 2 should pass", async () => {
11
- expect(1 + 1).toBe(2);
12
- });
13
-
14
- test("Test 3 should fail", async () => {
15
- expect(true).toBe(true);
16
- });
17
- });