@stanterprise/playwright-reporter 0.0.0-debug-flag-3 → 0.0.0-debug-flag-4

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.
@@ -36,6 +36,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.initDebugFile = initDebugFile;
37
37
  exports.writeDebugEntry = writeDebugEntry;
38
38
  const fs = __importStar(require("fs"));
39
+ function normalizeDebugMessage(message) {
40
+ if (!message || typeof message !== "object") {
41
+ return message;
42
+ }
43
+ const serializable = message;
44
+ try {
45
+ if (typeof serializable.toJson === "function") {
46
+ return serializable.toJson();
47
+ }
48
+ if (typeof serializable.toJSON === "function") {
49
+ return serializable.toJSON();
50
+ }
51
+ if (typeof serializable.toObject === "function") {
52
+ return serializable.toObject();
53
+ }
54
+ }
55
+ catch {
56
+ // Fall through to the original object when serialization helpers throw.
57
+ }
58
+ return message;
59
+ }
39
60
  /**
40
61
  * Creates or truncates the debug JSONL file so each test run starts with a clean file.
41
62
  * No-op when debug mode is disabled.
@@ -64,7 +85,7 @@ function writeDebugEntry(options, path, message) {
64
85
  const entry = {
65
86
  timestamp: new Date().toISOString(),
66
87
  path,
67
- message,
88
+ message: normalizeDebugMessage(message),
68
89
  };
69
90
  try {
70
91
  fs.appendFileSync(filePath, JSON.stringify(entry) + "\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stanterprise/playwright-reporter",
3
- "version": "0.0.0-debug-flag-3",
3
+ "version": "0.0.0debug-flag-4",
4
4
  "description": "Custom Playwright test reporter that sends test results to Stanterprise via gRPC",
5
5
  "homepage": "https://github.com/stanterprise/stanterprise-playwright-reporter#readme",
6
6
  "bugs": {