@heal-dev/heal-playwright-tracer 1.0.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 (125) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +245 -0
  3. package/dist/application/babel-playwright-tracer-plugin/index.d.ts +16 -0
  4. package/dist/application/babel-playwright-tracer-plugin/index.js +111 -0
  5. package/dist/application/heal-config/index.d.ts +8 -0
  6. package/dist/application/heal-config/index.js +22 -0
  7. package/dist/application/heal-config/registry.d.ts +37 -0
  8. package/dist/application/heal-config/registry.js +64 -0
  9. package/dist/application/heal-config/types.d.ts +73 -0
  10. package/dist/application/heal-config/types.js +7 -0
  11. package/dist/application/playwright-fixture/index.d.ts +14 -0
  12. package/dist/application/playwright-fixture/index.js +234 -0
  13. package/dist/application/trace-event-recorder-runtime/index.d.ts +15 -0
  14. package/dist/application/trace-event-recorder-runtime/index.js +68 -0
  15. package/dist/domain/code-hook-injector/service/meta-fields/enclosing-scope-labeler.d.ts +12 -0
  16. package/dist/domain/code-hook-injector/service/meta-fields/enclosing-scope-labeler.js +53 -0
  17. package/dist/domain/code-hook-injector/service/meta-fields/leading-comment-extractor.d.ts +14 -0
  18. package/dist/domain/code-hook-injector/service/meta-fields/leading-comment-extractor.js +20 -0
  19. package/dist/domain/code-hook-injector/service/meta-fields/relative-file-path.d.ts +6 -0
  20. package/dist/domain/code-hook-injector/service/meta-fields/relative-file-path.js +57 -0
  21. package/dist/domain/code-hook-injector/service/meta-fields/source-snippet-extractor.d.ts +12 -0
  22. package/dist/domain/code-hook-injector/service/meta-fields/source-snippet-extractor.js +28 -0
  23. package/dist/domain/code-hook-injector/service/playwright-import-rewriter.d.ts +10 -0
  24. package/dist/domain/code-hook-injector/service/playwright-import-rewriter.js +21 -0
  25. package/dist/domain/code-hook-injector/service/statement-analysis/cjs-artifact-detector.d.ts +14 -0
  26. package/dist/domain/code-hook-injector/service/statement-analysis/cjs-artifact-detector.js +30 -0
  27. package/dist/domain/code-hook-injector/service/statement-analysis/for-head-declaration-detector.d.ts +10 -0
  28. package/dist/domain/code-hook-injector/service/statement-analysis/for-head-declaration-detector.js +18 -0
  29. package/dist/domain/code-hook-injector/service/statement-analysis/leaf-statement-classifier.d.ts +15 -0
  30. package/dist/domain/code-hook-injector/service/statement-analysis/leaf-statement-classifier.js +66 -0
  31. package/dist/domain/code-hook-injector/service/statement-analysis/non-wrappable-statement.d.ts +11 -0
  32. package/dist/domain/code-hook-injector/service/statement-analysis/non-wrappable-statement.js +20 -0
  33. package/dist/domain/code-hook-injector/service/trace-hook/enter-meta-literal.d.ts +20 -0
  34. package/dist/domain/code-hook-injector/service/trace-hook/enter-meta-literal.js +34 -0
  35. package/dist/domain/code-hook-injector/service/trace-hook/global-trace-call.d.ts +10 -0
  36. package/dist/domain/code-hook-injector/service/trace-hook/global-trace-call.js +16 -0
  37. package/dist/domain/code-hook-injector/service/trace-hook/try-finally-wrapper.d.ts +18 -0
  38. package/dist/domain/code-hook-injector/service/trace-hook/try-finally-wrapper.js +44 -0
  39. package/dist/domain/code-hook-injector/service/trace-hook/variable-declaration-hoister.d.ts +20 -0
  40. package/dist/domain/code-hook-injector/service/trace-hook/variable-declaration-hoister.js +27 -0
  41. package/dist/domain/code-hook-injector/service/traced-file-matcher.d.ts +10 -0
  42. package/dist/domain/code-hook-injector/service/traced-file-matcher.js +26 -0
  43. package/dist/domain/trace-event-recorder/model/enter-meta.d.ts +24 -0
  44. package/dist/domain/trace-event-recorder/model/enter-meta.js +7 -0
  45. package/dist/domain/trace-event-recorder/model/global-names.d.ts +8 -0
  46. package/dist/domain/trace-event-recorder/model/global-names.js +20 -0
  47. package/dist/domain/trace-event-recorder/model/serialized-error.d.ts +16 -0
  48. package/dist/domain/trace-event-recorder/model/serialized-error.js +7 -0
  49. package/dist/domain/trace-event-recorder/model/statement-trace-schema.d.ts +171 -0
  50. package/dist/domain/trace-event-recorder/model/statement-trace-schema.js +33 -0
  51. package/dist/domain/trace-event-recorder/model/trace-schema.d.ts +114 -0
  52. package/dist/domain/trace-event-recorder/model/trace-schema.js +16 -0
  53. package/dist/domain/trace-event-recorder/port/clock.d.ts +9 -0
  54. package/dist/domain/trace-event-recorder/port/clock.js +7 -0
  55. package/dist/domain/trace-event-recorder/port/heal-trace-exporter.d.ts +11 -0
  56. package/dist/domain/trace-event-recorder/port/heal-trace-exporter.js +7 -0
  57. package/dist/domain/trace-event-recorder/port/system-info-provider.d.ts +18 -0
  58. package/dist/domain/trace-event-recorder/port/system-info-provider.js +7 -0
  59. package/dist/domain/trace-event-recorder/port/trace-event-consumer.d.ts +11 -0
  60. package/dist/domain/trace-event-recorder/port/trace-event-consumer.js +7 -0
  61. package/dist/domain/trace-event-recorder/service/active-enter-stack.d.ts +15 -0
  62. package/dist/domain/trace-event-recorder/service/active-enter-stack.js +34 -0
  63. package/dist/domain/trace-event-recorder/service/event-builders/enter-event-builder.d.ts +8 -0
  64. package/dist/domain/trace-event-recorder/service/event-builders/enter-event-builder.js +37 -0
  65. package/dist/domain/trace-event-recorder/service/event-builders/meta-event-builder.d.ts +7 -0
  66. package/dist/domain/trace-event-recorder/service/event-builders/meta-event-builder.js +19 -0
  67. package/dist/domain/trace-event-recorder/service/event-builders/ok-event-builder.d.ts +7 -0
  68. package/dist/domain/trace-event-recorder/service/event-builders/ok-event-builder.js +27 -0
  69. package/dist/domain/trace-event-recorder/service/event-builders/throw-event-builder.d.ts +7 -0
  70. package/dist/domain/trace-event-recorder/service/event-builders/throw-event-builder.js +23 -0
  71. package/dist/domain/trace-event-recorder/service/exporters/composite-heal-trace-exporter.d.ts +12 -0
  72. package/dist/domain/trace-event-recorder/service/exporters/composite-heal-trace-exporter.js +32 -0
  73. package/dist/domain/trace-event-recorder/service/index.d.ts +10 -0
  74. package/dist/domain/trace-event-recorder/service/index.js +15 -0
  75. package/dist/domain/trace-event-recorder/service/projectors/index.d.ts +6 -0
  76. package/dist/domain/trace-event-recorder/service/projectors/index.js +10 -0
  77. package/dist/domain/trace-event-recorder/service/projectors/statement-projector.d.ts +26 -0
  78. package/dist/domain/trace-event-recorder/service/projectors/statement-projector.js +183 -0
  79. package/dist/domain/trace-event-recorder/service/serializers/error-serializer.d.ts +8 -0
  80. package/dist/domain/trace-event-recorder/service/serializers/error-serializer.js +49 -0
  81. package/dist/domain/trace-event-recorder/service/serializers/variable-snapshot-serializer.d.ts +7 -0
  82. package/dist/domain/trace-event-recorder/service/serializers/variable-snapshot-serializer.js +102 -0
  83. package/dist/domain/trace-event-recorder/service/trace-event-recorder-state.d.ts +19 -0
  84. package/dist/domain/trace-event-recorder/service/trace-event-recorder-state.js +7 -0
  85. package/dist/domain/trace-event-recorder/service/trace-event-recorder.d.ts +56 -0
  86. package/dist/domain/trace-event-recorder/service/trace-event-recorder.js +80 -0
  87. package/dist/index.d.ts +11 -0
  88. package/dist/index.js +43 -0
  89. package/dist/infrastructure/ndjson-exporter-adapter/index.d.ts +6 -0
  90. package/dist/infrastructure/ndjson-exporter-adapter/index.js +10 -0
  91. package/dist/infrastructure/ndjson-exporter-adapter/ndjson-exporter.d.ts +13 -0
  92. package/dist/infrastructure/ndjson-exporter-adapter/ndjson-exporter.js +77 -0
  93. package/dist/infrastructure/perf-hooks-clock-adapter/index.d.ts +6 -0
  94. package/dist/infrastructure/perf-hooks-clock-adapter/index.js +10 -0
  95. package/dist/infrastructure/perf-hooks-clock-adapter/perf-hooks-clock.d.ts +11 -0
  96. package/dist/infrastructure/perf-hooks-clock-adapter/perf-hooks-clock.js +22 -0
  97. package/dist/infrastructure/playwright-locator-screenshot-adapter/assertion-wrapper.d.ts +6 -0
  98. package/dist/infrastructure/playwright-locator-screenshot-adapter/assertion-wrapper.js +109 -0
  99. package/dist/infrastructure/playwright-locator-screenshot-adapter/index.d.ts +9 -0
  100. package/dist/infrastructure/playwright-locator-screenshot-adapter/index.js +21 -0
  101. package/dist/infrastructure/playwright-locator-screenshot-adapter/locator-patch.d.ts +11 -0
  102. package/dist/infrastructure/playwright-locator-screenshot-adapter/locator-patch.js +79 -0
  103. package/dist/infrastructure/playwright-locator-screenshot-adapter/overlay-helpers.d.ts +15 -0
  104. package/dist/infrastructure/playwright-locator-screenshot-adapter/overlay-helpers.js +33 -0
  105. package/dist/infrastructure/playwright-locator-screenshot-adapter/screenshot-capture-session.d.ts +26 -0
  106. package/dist/infrastructure/playwright-locator-screenshot-adapter/screenshot-capture-session.js +125 -0
  107. package/dist/infrastructure/playwright-step-tracking-adapter/index.d.ts +7 -0
  108. package/dist/infrastructure/playwright-step-tracking-adapter/index.js +10 -0
  109. package/dist/infrastructure/playwright-step-tracking-adapter/playwright-step-tracking-adapter.d.ts +14 -0
  110. package/dist/infrastructure/playwright-step-tracking-adapter/playwright-step-tracking-adapter.js +51 -0
  111. package/dist/infrastructure/playwright-test-context-adapter/heal-tag-prefix.d.ts +25 -0
  112. package/dist/infrastructure/playwright-test-context-adapter/heal-tag-prefix.js +28 -0
  113. package/dist/infrastructure/playwright-test-context-adapter/index.d.ts +8 -0
  114. package/dist/infrastructure/playwright-test-context-adapter/index.js +12 -0
  115. package/dist/infrastructure/playwright-test-context-adapter/playwright-test-context-adapter.d.ts +19 -0
  116. package/dist/infrastructure/playwright-test-context-adapter/playwright-test-context-adapter.js +43 -0
  117. package/dist/infrastructure/stdout-capture-adapter/index.d.ts +7 -0
  118. package/dist/infrastructure/stdout-capture-adapter/index.js +10 -0
  119. package/dist/infrastructure/stdout-capture-adapter/stdout-capture-session.d.ts +20 -0
  120. package/dist/infrastructure/stdout-capture-adapter/stdout-capture-session.js +47 -0
  121. package/dist/infrastructure/system-info-adapter/index.d.ts +6 -0
  122. package/dist/infrastructure/system-info-adapter/index.js +10 -0
  123. package/dist/infrastructure/system-info-adapter/system-info-adapter.d.ts +12 -0
  124. package/dist/infrastructure/system-info-adapter/system-info-adapter.js +83 -0
  125. package/package.json +95 -0
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright: (c) Myia SAS 2026.
3
+ * This file and its contents are licensed under the AGPLv3 License.
4
+ * Please see the LICENSE file at the root of this repository
5
+ */
6
+ /**
7
+ * Reserved Playwright tag prefix used to embed a Heal test case id on
8
+ * a test. The suffix is the raw test case id, e.g. `@heal-tc_abc123`.
9
+ *
10
+ * This tag is the sole source of truth for linking a Playwright run
11
+ * to a Heal test case — chosen over Playwright annotations because
12
+ * tags are filterable from the CLI (`npx playwright test -g
13
+ * "@heal-tc_abc|@heal-tc_def"`), which lets the backend trigger a
14
+ * specific set of test cases without resolving file paths or line
15
+ * numbers.
16
+ *
17
+ * Inheritance caveat: Playwright's `TestInfo.tags` merges tags from
18
+ * the enclosing `test.describe(...)` block with tags on the
19
+ * `test(...)` call itself, and provides no discriminator. Tagging a
20
+ * describe with `@heal-*` therefore propagates the same id to every
21
+ * test inside. We accept this at extraction time; the backend is
22
+ * responsible for rejecting runs where a single testCaseId resolves
23
+ * to multiple distinct testIds.
24
+ */
25
+ export declare const HEAL_TAG_PREFIX = "@heal-";
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright: (c) Myia SAS 2026.
4
+ * This file and its contents are licensed under the AGPLv3 License.
5
+ * Please see the LICENSE file at the root of this repository
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.HEAL_TAG_PREFIX = void 0;
9
+ /**
10
+ * Reserved Playwright tag prefix used to embed a Heal test case id on
11
+ * a test. The suffix is the raw test case id, e.g. `@heal-tc_abc123`.
12
+ *
13
+ * This tag is the sole source of truth for linking a Playwright run
14
+ * to a Heal test case — chosen over Playwright annotations because
15
+ * tags are filterable from the CLI (`npx playwright test -g
16
+ * "@heal-tc_abc|@heal-tc_def"`), which lets the backend trigger a
17
+ * specific set of test cases without resolving file paths or line
18
+ * numbers.
19
+ *
20
+ * Inheritance caveat: Playwright's `TestInfo.tags` merges tags from
21
+ * the enclosing `test.describe(...)` block with tags on the
22
+ * `test(...)` call itself, and provides no discriminator. Tagging a
23
+ * describe with `@heal-*` therefore propagates the same id to every
24
+ * test inside. We accept this at extraction time; the backend is
25
+ * responsible for rejecting runs where a single testCaseId resolves
26
+ * to multiple distinct testIds.
27
+ */
28
+ exports.HEAL_TAG_PREFIX = '@heal-';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright: (c) Myia SAS 2026.
3
+ * This file and its contents are licensed under the AGPLv3 License.
4
+ * Please see the LICENSE file at the root of this repository
5
+ */
6
+ export { PlaywrightTestContextAdapter } from './playwright-test-context-adapter';
7
+ export type { CapturedContext, TestContextHooks } from './playwright-test-context-adapter';
8
+ export { HEAL_TAG_PREFIX } from './heal-tag-prefix';
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright: (c) Myia SAS 2026.
4
+ * This file and its contents are licensed under the AGPLv3 License.
5
+ * Please see the LICENSE file at the root of this repository
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.HEAL_TAG_PREFIX = exports.PlaywrightTestContextAdapter = void 0;
9
+ var playwright_test_context_adapter_1 = require("./playwright-test-context-adapter");
10
+ Object.defineProperty(exports, "PlaywrightTestContextAdapter", { enumerable: true, get: function () { return playwright_test_context_adapter_1.PlaywrightTestContextAdapter; } });
11
+ var heal_tag_prefix_1 = require("./heal-tag-prefix");
12
+ Object.defineProperty(exports, "HEAL_TAG_PREFIX", { enumerable: true, get: function () { return heal_tag_prefix_1.HEAL_TAG_PREFIX; } });
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright: (c) Myia SAS 2026.
3
+ * This file and its contents are licensed under the AGPLv3 License.
4
+ * Please see the LICENSE file at the root of this repository
5
+ */
6
+ import type { TestInfo } from '@playwright/test';
7
+ export interface CapturedContext {
8
+ testId: string;
9
+ attempt: number;
10
+ testCaseId?: number;
11
+ }
12
+ export interface TestContextHooks {
13
+ setContext(ctx: Record<string, unknown> | null): void;
14
+ }
15
+ export declare class PlaywrightTestContextAdapter {
16
+ private readonly hooks;
17
+ constructor(hooks: TestContextHooks);
18
+ capture(testInfo: TestInfo): CapturedContext;
19
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright: (c) Myia SAS 2026.
4
+ * This file and its contents are licensed under the AGPLv3 License.
5
+ * Please see the LICENSE file at the root of this repository
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.PlaywrightTestContextAdapter = void 0;
9
+ const heal_tag_prefix_1 = require("./heal-tag-prefix");
10
+ class PlaywrightTestContextAdapter {
11
+ constructor(hooks) {
12
+ this.hooks = hooks;
13
+ }
14
+ capture(testInfo) {
15
+ const attempt = testInfo.retry + 1;
16
+ const rawTagSuffix = testInfo.tags.find((t) => t.startsWith(heal_tag_prefix_1.HEAL_TAG_PREFIX))?.slice(heal_tag_prefix_1.HEAL_TAG_PREFIX.length) ?? '';
17
+ // Only digits allowed — the backend schema stores testCaseId as
18
+ // bigint. Anything else (empty, letters, negative, leading zeros
19
+ // parsed to 0) is treated as "no id" so the run goes to the
20
+ // unlinked bucket instead of silently mis-linking.
21
+ const testCaseId = /^[1-9]\d*$/.test(rawTagSuffix)
22
+ ? Number.parseInt(rawTagSuffix, 10)
23
+ : undefined;
24
+ this.hooks.setContext({
25
+ workerIndex: testInfo.workerIndex,
26
+ parallelIndex: testInfo.parallelIndex,
27
+ testId: testInfo.testId,
28
+ testTitle: testInfo.title,
29
+ titlePath: testInfo.titlePath,
30
+ projectName: testInfo.project.name,
31
+ testFile: testInfo.file,
32
+ retry: testInfo.retry,
33
+ attempt,
34
+ ...(testCaseId ? { testCaseId } : {}),
35
+ });
36
+ return {
37
+ testId: testInfo.testId,
38
+ attempt,
39
+ ...(testCaseId ? { testCaseId } : {}),
40
+ };
41
+ }
42
+ }
43
+ exports.PlaywrightTestContextAdapter = PlaywrightTestContextAdapter;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copyright: (c) Myia SAS 2026.
3
+ * This file and its contents are licensed under the AGPLv3 License.
4
+ * Please see the LICENSE file at the root of this repository
5
+ */
6
+ export { StdoutCaptureSession } from './stdout-capture-session';
7
+ export type { StdoutCaptureResult } from './stdout-capture-session';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright: (c) Myia SAS 2026.
4
+ * This file and its contents are licensed under the AGPLv3 License.
5
+ * Please see the LICENSE file at the root of this repository
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.StdoutCaptureSession = void 0;
9
+ var stdout_capture_session_1 = require("./stdout-capture-session");
10
+ Object.defineProperty(exports, "StdoutCaptureSession", { enumerable: true, get: function () { return stdout_capture_session_1.StdoutCaptureSession; } });
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright: (c) Myia SAS 2026.
3
+ * This file and its contents are licensed under the AGPLv3 License.
4
+ * Please see the LICENSE file at the root of this repository
5
+ */
6
+ export interface StdoutCaptureResult {
7
+ stdout: string[];
8
+ stderr: string[];
9
+ }
10
+ export declare class StdoutCaptureSession {
11
+ private readonly stdoutBuf;
12
+ private readonly stderrBuf;
13
+ private readonly origStdout;
14
+ private readonly origStderr;
15
+ private stopped;
16
+ constructor();
17
+ stop(): StdoutCaptureResult;
18
+ private makePatched;
19
+ private static chunkToString;
20
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright: (c) Myia SAS 2026.
4
+ * This file and its contents are licensed under the AGPLv3 License.
5
+ * Please see the LICENSE file at the root of this repository
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.StdoutCaptureSession = void 0;
9
+ class StdoutCaptureSession {
10
+ constructor() {
11
+ this.stdoutBuf = [];
12
+ this.stderrBuf = [];
13
+ this.stopped = false;
14
+ // Save the raw property value (not a bound wrapper) so stop() can
15
+ // put back exactly the function that was installed, not an identity
16
+ // copy of it. We restore `this` manually on the forward-call below.
17
+ this.origStdout = process.stdout.write;
18
+ this.origStderr = process.stderr.write;
19
+ process.stdout.write = this.makePatched(this.stdoutBuf, this.origStdout, process.stdout);
20
+ process.stderr.write = this.makePatched(this.stderrBuf, this.origStderr, process.stderr);
21
+ }
22
+ stop() {
23
+ if (this.stopped) {
24
+ return { stdout: this.stdoutBuf, stderr: this.stderrBuf };
25
+ }
26
+ this.stopped = true;
27
+ process.stdout.write = this.origStdout;
28
+ process.stderr.write = this.origStderr;
29
+ return { stdout: this.stdoutBuf, stderr: this.stderrBuf };
30
+ }
31
+ makePatched(buf, orig, target) {
32
+ return function patched(chunk, ...rest) {
33
+ buf.push(StdoutCaptureSession.chunkToString(chunk, rest[0]));
34
+ return orig.call(target, chunk, ...rest);
35
+ };
36
+ }
37
+ static chunkToString(chunk, encoding) {
38
+ if (typeof chunk === 'string')
39
+ return chunk;
40
+ if (chunk instanceof Uint8Array) {
41
+ const enc = typeof encoding === 'string' ? encoding : 'utf8';
42
+ return Buffer.from(chunk).toString(enc);
43
+ }
44
+ return String(chunk);
45
+ }
46
+ }
47
+ exports.StdoutCaptureSession = StdoutCaptureSession;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright: (c) Myia SAS 2026.
3
+ * This file and its contents are licensed under the AGPLv3 License.
4
+ * Please see the LICENSE file at the root of this repository
5
+ */
6
+ export { SystemInfoAdapter } from './system-info-adapter';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright: (c) Myia SAS 2026.
4
+ * This file and its contents are licensed under the AGPLv3 License.
5
+ * Please see the LICENSE file at the root of this repository
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.SystemInfoAdapter = void 0;
9
+ var system_info_adapter_1 = require("./system-info-adapter");
10
+ Object.defineProperty(exports, "SystemInfoAdapter", { enumerable: true, get: function () { return system_info_adapter_1.SystemInfoAdapter; } });
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright: (c) Myia SAS 2026.
3
+ * This file and its contents are licensed under the AGPLv3 License.
4
+ * Please see the LICENSE file at the root of this repository
5
+ */
6
+ import type { SystemInfo, SystemInfoProvider } from '../../domain/trace-event-recorder/port/system-info-provider';
7
+ export declare class SystemInfoAdapter implements SystemInfoProvider {
8
+ private readonly info;
9
+ constructor();
10
+ getStaticContext(): SystemInfo;
11
+ private static readGitSha;
12
+ }
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright: (c) Myia SAS 2026.
4
+ * This file and its contents are licensed under the AGPLv3 License.
5
+ * Please see the LICENSE file at the root of this repository
6
+ */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
20
+ }) : function(o, v) {
21
+ o["default"] = v;
22
+ });
23
+ var __importStar = (this && this.__importStar) || (function () {
24
+ var ownKeys = function(o) {
25
+ ownKeys = Object.getOwnPropertyNames || function (o) {
26
+ var ar = [];
27
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
28
+ return ar;
29
+ };
30
+ return ownKeys(o);
31
+ };
32
+ return function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ })();
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.SystemInfoAdapter = void 0;
42
+ // SystemInfoAdapter — default SystemInfoProvider implementation.
43
+ //
44
+ // Reads per-process technical state once: Node version, platform,
45
+ // arch, hostname, CI flag, cwd, pid, and the current git SHA
46
+ // (best-effort; empty when not a git repo). All values are captured
47
+ // eagerly at construction so repeated calls are free and the shell
48
+ // out to `git rev-parse HEAD` happens at most once per process.
49
+ //
50
+ // Tests do NOT use this adapter — they pass a stub implementing
51
+ // SystemInfoProvider with fixed values for deterministic assertions.
52
+ const os = __importStar(require("os"));
53
+ const child_process_1 = require("child_process");
54
+ class SystemInfoAdapter {
55
+ constructor() {
56
+ this.info = {
57
+ pid: process.pid,
58
+ nodeVersion: process.versions.node,
59
+ platform: process.platform,
60
+ arch: process.arch,
61
+ hostname: os.hostname(),
62
+ isCI: !!process.env.CI,
63
+ cwd: process.cwd(),
64
+ gitSha: SystemInfoAdapter.readGitSha(),
65
+ };
66
+ }
67
+ getStaticContext() {
68
+ return this.info;
69
+ }
70
+ static readGitSha() {
71
+ try {
72
+ return (0, child_process_1.execSync)('git rev-parse HEAD', {
73
+ stdio: ['ignore', 'pipe', 'ignore'],
74
+ })
75
+ .toString()
76
+ .trim();
77
+ }
78
+ catch (_) {
79
+ return undefined;
80
+ }
81
+ }
82
+ }
83
+ exports.SystemInfoAdapter = SystemInfoAdapter;
package/package.json ADDED
@@ -0,0 +1,95 @@
1
+ {
2
+ "name": "@heal-dev/heal-playwright-tracer",
3
+ "repository": {
4
+ "type": "git",
5
+ "url": "git+https://github.com/heal-dev/heal-playwright-tracer.git"
6
+ },
7
+ "version": "1.0.0",
8
+ "description": "Statement-level execution tracer for Playwright tests. Records every executed line with timing, variable values, call depth, errors, and Playwright API correlations.",
9
+ "main": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "./code-hook-injector": {
17
+ "types": "./dist/application/babel-playwright-tracer-plugin/index.d.ts",
18
+ "default": "./dist/application/babel-playwright-tracer-plugin/index.js"
19
+ },
20
+ "./trace-event-recorder": {
21
+ "types": "./dist/domain/trace-event-recorder/service/entrypoint.d.ts",
22
+ "default": "./dist/domain/trace-event-recorder/service/entrypoint.js"
23
+ },
24
+ "./statement-trace-schema": {
25
+ "types": "./dist/domain/trace-event-recorder/model/statement-trace-schema.d.ts",
26
+ "default": "./dist/domain/trace-event-recorder/model/statement-trace-schema.js"
27
+ },
28
+ "./heal-trace-exporter": {
29
+ "types": "./dist/domain/trace-event-recorder/port/heal-trace-exporter.d.ts",
30
+ "default": "./dist/domain/trace-event-recorder/port/heal-trace-exporter.js"
31
+ }
32
+ },
33
+ "files": [
34
+ "dist/",
35
+ "README.md"
36
+ ],
37
+ "scripts": {
38
+ "clean": "rm -rf dist",
39
+ "build": "npm run clean && tsc -p tsconfig.json",
40
+ "test": "vitest run",
41
+ "test:watch": "vitest",
42
+ "test:integration": "vitest run --config vitest.integration.config.ts",
43
+ "test:coverage": "rm -rf coverage && vitest run --coverage",
44
+ "typecheck": "tsc -p tsconfig.lint.json",
45
+ "lint": "eslint src tests",
46
+ "lint:fix": "eslint src tests --fix",
47
+ "format": "prettier --write .",
48
+ "format:check": "prettier --check .",
49
+ "check": "npm run typecheck && npm run lint && npm run format:check",
50
+ "prepack": "npm run build",
51
+ "prepublishOnly": "npm run build",
52
+ "prepare": "husky"
53
+ },
54
+ "lint-staged": {
55
+ "*.{ts,js}": [
56
+ "prettier --write",
57
+ "eslint --fix"
58
+ ],
59
+ "*.{json,md}": [
60
+ "prettier --write"
61
+ ]
62
+ },
63
+ "keywords": [
64
+ "playwright",
65
+ "tracing",
66
+ "instrumentation",
67
+ "babel-plugin",
68
+ "test-runner",
69
+ "observability"
70
+ ],
71
+ "peerDependencies": {
72
+ "@playwright/test": ">=1.50.0"
73
+ },
74
+ "devDependencies": {
75
+ "@babel/core": "^7.29.0",
76
+ "@babel/parser": "^7.29.2",
77
+ "@playwright/test": "1.58.1",
78
+ "@types/babel__core": "^7.20.5",
79
+ "@types/babel__traverse": "^7.28.0",
80
+ "@types/node": "^22.0.0",
81
+ "@vitest/coverage-istanbul": "^4.1.4",
82
+ "eslint": "^9.39.4",
83
+ "eslint-plugin-headers": "^1.3.4",
84
+ "husky": "^9.1.7",
85
+ "lint-staged": "^15.5.2",
86
+ "prettier": "^3.8.3",
87
+ "typescript": "^5.4.0",
88
+ "typescript-eslint": "^8.58.2",
89
+ "vitest": "^4.1.4"
90
+ },
91
+ "engines": {
92
+ "node": ">=18"
93
+ },
94
+ "license": "UNLICENSED"
95
+ }