Fix status file

This commit is contained in:
Ashcon Partovi
2024-06-19 01:03:01 -07:00
parent 92775854ba
commit 1baca0b9e4

View File

@@ -11,6 +11,7 @@ import {
appendFileSync,
readdirSync,
rmSync,
writeFileSync,
} from "node:fs";
import { spawn, spawnSync } from "node:child_process";
import { tmpdir, hostname, userInfo, homedir } from "node:os";
@@ -106,8 +107,14 @@ async function runTests(target, filters) {
if (isBuildKite) {
const { ok, testPath, error, stdout, stdoutPreview } = result;
const logsPath = join(cwd, "logs");
mkdirSync(logsPath, { recursive: true });
const logFilePath = join(logsPath, `${testPath}.log`);
mkdirSync(dirname(logFilePath), { recursive: true });
writeFileSync(logFilePath, stripAnsi(stdout));
if (!ok) {
uploadArtifactsToBuildKite(logFilePath);
}
const statusFilePath = join(logsPath, ok ? "PASSED.txt" : "FAILED.txt");
appendFileSync(statusFilePath, `${testPath}\n`);
@@ -115,12 +122,6 @@ async function runTests(target, filters) {
uploadArtifactsToBuildKite(statusFilePath);
}
const logFilePath = join(logsPath, `${testPath}.log`);
appendFileSync(logFilePath, stripAnsi(stdout));
if (!ok) {
uploadArtifactsToBuildKite(logFilePath);
}
const markdown = formatTestToMarkdown(result);
if (markdown) {
reportAnnotationToBuildKite(title, markdown);