ylliX - Online Advertising Network
Vertex AI - Antrophic and Mistral models: Why does it require Imegen access?

When running Playwright in a Node environment and specifying the reporter as JSON, it generates an extra pair of curly braces


When I run the following command, it generates the following JSON content. Because this log is not in standard JSON format, the data cannot be parsed by JSON (because the generated content has extra curly braces). This issue occurs occasionally and is not consistent. I would like to ask if anyone has encountered this situation, or if there is a more elegant way to output the content to JSON.

npx playwright test tests/vnode.spec.ts --grep="vnode edit-vnode" --reporter=json  > /workspace/attachments/tests_vnode.spec.ts.json 

{
  "config": {
    "configFile": "/workspace/playwright.config.ts",
    "rootDir": "/workspace/tests",
    "forbidOnly": false,
    "fullyParallel": true,
    "globalSetup": null,
    "globalTeardown": null,
    "globalTimeout": 0,
    "grep": {},
    "grepInvert": null,
    "maxFailures": 0,
    "metadata": {
      "actualWorkers": 1
    },
    "preserveOutput": "always",
    "reporter": [
      [
        "json"
      ]
    ],
    "reportSlowTests": {
      "max": 5,
      "threshold": 15000
    },
    "quiet": false,
    "projects": [
      {
        "outputDir": "/workspace/test-results",
        "repeatEach": 1,
        "retries": 0,
        "metadata": {},
        "id": "chromium",
        "name": "chromium",
        "testDir": "/workspace/tests",
        "testIgnore": [],
        "testMatch": [
          "**/*.@(spec|test).?(c|m)[jt]s?(x)"
        ],
        "timeout": 30000
      }
    ],
    "shard": null,
    "updateSnapshots": "missing",
    "version": "1.48.1",
    "workers": 8,
    "webServer": null
  },
  "suites": [
    {
      "title": "vnode.spec.ts",
      "file": "vnode.spec.ts",
      "column": 0,
      "line": 0,
      "specs": [],
      "suites": [
        {
          "title": "vnode",
          "file": "vnode.spec.ts",
          "line": 8,
          "column": 6,
          "specs": [
            {
              "title": "create-vnode",
              "ok": true,
              "tags": [],
              "tests": [
                {
                  "timeout": 30000,
                  "annotations": [],
                  "expectedStatus": "passed",
                  "projectId": "chromium",
                  "projectName": "chromium",
                  "results": [
                    {
                      "workerIndex": 0,
                      "status": "passed",
                      "duration": 17708,
                      "errors": [],
                      "stdout": [],
                      "stderr": [],
                      "retry": 0,
                      "startTime": "2024-10-22T07:08:57.351Z",
                      "attachments": []
                    }
                  ],
                  "status": "expected"
                }
              ],
              "id": "43521ec4d8604be9e3ec-5c6bb1a2741a7ab71f2d",
              "file": "vnode.spec.ts",
              "line": 11,
              "column": 7
            },
            {
              "title": "del-vnode",
              "ok": true,
              "tags": [],
              "tests": [
                {
                  "timeout": 30000,
                  "annotations": [],
                  "expectedStatus": "passed",
                  "projectId": "chromium",
                  "projectName": "chromium",
                  "results": [
                    {
                      "workerIndex": 0,
                      "status": "passed",
                      "duration": 12408,
                      "errors": [],
                      "stdout": [],
                      "stderr": [],
                      "retry": 0,
                      "startTime": "2024-10-22T07:09:15.199Z",
                      "attachments": []
                    }
                  ],
                  "status": "expected"
                }
              ],
              "id": "43521ec4d8604be9e3ec-ba8d59b503cddc193861",
              "file": "vnode.spec.ts",
              "line": 77,
              "column": 7
            }
          ]
        }
      ]
    }
  ],
  "errors": [],
  "stats": {
    "startTime": "2024-10-22T07:08:56.653Z",
    "duration": 30998.129,
    "expected": 2,
    "skipped": 0,
    "unexpected": 0,
    "flaky": 0
  }
}
                "status": "unexpected"
                }
              ],
              "id": "43521ec4d8604be9e3ec-ebd04a5dbb32242de527",
              "file": "vnode.spec.ts",
              "line": 53,
              "column": 7
            }
          ]
        }
      ]
    }
  ],
  "errors": [],
  "stats": {
    "startTime": "2024-10-22T07:08:56.841Z",
    "duration": 30770.147,
    "expected": 0,
    "skipped": 0,
    "unexpected": 1,
    "flaky": 0
  }
}

I previously set the environment variable PLAYWRIGHT_JSON_OUTPUT_NAME to output the file content. However, this method was abandoned because concurrent commands interfere with each other. Could you please let me know if there are any other methods to output JSON content to a file?



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *