override async onEnd()

in src/reporters/junit.ts [124:149]


  override async onEnd() {
    const root: XMLEntry = {
      name: 'testsuites',
      attributes: {
        name: '',
        tests: this.totalTests,
        failures: this.totalFailures,
        skipped: this.totalSkipped,
        errors: 0,
        time: parseInt(String(now())) / 1000,
      },
      children: [...this.#journeyMap.values()],
    };

    const output = serializeEntries(root).join('\n');
    /**
     * write the xml output to a file if specified via env flag
     */
    const fileName = process.env['SYNTHETICS_JUNIT_FILE'];
    if (fileName) {
      await mkdir(dirname(fileName), { recursive: true });
      await writeFile(fileName, output);
    } else {
      this.write(output);
    }
  }