Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test2 #23

Merged
merged 6 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test PR
name: Test PRa
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
Expand Down
39 changes: 23 additions & 16 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40074,8 +40074,6 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms));
let status = response.data.status;
let conclusion = response.data.conclusion;

console.log(chalk.green("TestDriver:"), '"Status:"', status);

return { status, conclusion };
};

Expand All @@ -40092,20 +40090,13 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms));
conclusion = resp.conclusion;
}

if (conclusion === "failure") {
console.log(
chalk.green("TestDriver:"),
chalk.red('"The workflow has failed!"')
);
}

return conclusion;
};

await waitUntilComplete();
let conc = await waitUntilComplete();

console.log(chalk.green("TestDriver:"), chalk.green('"Done!"'));
console.log(chalk.green("TestDriver:"), '"Writing my report..."'.green);
console.log(chalk.green("TestDriver:"), "Writing my report...");

const {
data: { shareLink, oiResult, exitcode },
Expand All @@ -40118,9 +40109,21 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms));
}
);

console.log(chalk.green("TestDriver:"), '"Interpreting results..."'.green);
console.log(chalk.green("TestDriver:"), "Interpreting results...");

console.log(chalk.green("TestDriver:"), `"Exit Code ${exitcode}"`.green);
console.log('')
console.log('Test Report:')
if (conc === "failure") {
console.log(
chalk.yellow("Workflow:"),
chalk.red('Fail')
);
} else {
console.log(
chalk.yellow("Workflow:"),
chalk.green('Pass')
);
}

const isPassed = parseInt(exitcode) === 0;

Expand All @@ -40129,27 +40132,31 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms));
}

if (isPassed) {
console.log(chalk.green("TestDriver:"), chalk.green('"PASS"'));
console.log(chalk.yellow("Test:"), chalk.green('Pass'));
} else {
console.log(chalk.green("TestDriver:"), chalk.red('"FAIL"'));
console.log(chalk.yellow("Test:"), chalk.red('Fail'));
}

let extractedFromMarkdown = extractLink(shareLink);

console.log('')
console.log(chalk.yellow("View Test Result on Dashcam.io:"));

if (extractedFromMarkdown) {
console.log(chalk.yellow("View Test Results on Dashcam.io"));
console.log(extractedFromMarkdown);
} else {
console.log(chalk.red("Something went wrong with Dashcam"));
console.log(shareLink);
}

console.log('')
console.log(chalk.yellow("TestDriver.ai Summary"));
console.log(oiResult);

core.setOutput("summary", oiResult);
core.setOutput("link", extractedFromMarkdown);
core.setOutput("markdown", shareLink);
core.setOutput("success", isPassed);

await core.summary
.addHeading("TestDriver.ai Results")
Expand Down
39 changes: 23 additions & 16 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms));
let status = response.data.status;
let conclusion = response.data.conclusion;

console.log(chalk.green("TestDriver:"), '"Status:"', status, '"Conclusion:"', conclusion);

return { status, conclusion };
};

Expand All @@ -135,20 +133,13 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms));
conclusion = resp.conclusion;
}

if (conclusion === "failure") {
console.log(
chalk.green("TestDriver:"),
chalk.red('"The workflow has failed!"')
);
}

return conclusion;
};

await waitUntilComplete();
let conc = await waitUntilComplete();

console.log(chalk.green("TestDriver:"), chalk.green('"Done!"'));
console.log(chalk.green("TestDriver:"), chalk.green('"Writing my report..."'));
console.log(chalk.green("TestDriver:"), "Writing my report...");

const {
data: { shareLink, oiResult, exitcode },
Expand All @@ -161,9 +152,21 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms));
}
);

console.log(chalk.green("TestDriver:"), chalk.green('"Interpreting results..."'));
console.log(chalk.green("TestDriver:"), "Interpreting results...");

console.log(chalk.green("TestDriver:"), chalk.green(`"Exit Code ${exitcode}"`, typeof exitcode));
console.log('')
console.log('Test Report:')
if (conc === "failure") {
console.log(
chalk.yellow("Workflow:"),
chalk.red('Fail')
);
} else {
console.log(
chalk.yellow("Workflow:"),
chalk.green('Pass')
);
}

const isPassed = parseInt(exitcode) === 0;

Expand All @@ -172,27 +175,31 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms));
}

if (isPassed) {
console.log(chalk.green("TestDriver:"), chalk.green('"PASS"'));
console.log(chalk.yellow("Test:"), chalk.green('Pass'));
} else {
console.log(chalk.green("TestDriver:"), chalk.red('"FAIL"'));
console.log(chalk.yellow("Test:"), chalk.red('Fail'));
}

let extractedFromMarkdown = extractLink(shareLink);

console.log('')
console.log(chalk.yellow("View Test Result on Dashcam.io:"));

if (extractedFromMarkdown) {
console.log(chalk.yellow("View Test Results on Dashcam.io"));
console.log(extractedFromMarkdown);
} else {
console.log(chalk.red("Something went wrong with Dashcam"));
console.log(shareLink);
}

console.log('')
console.log(chalk.yellow("TestDriver.ai Summary"));
console.log(oiResult);

core.setOutput("summary", oiResult);
core.setOutput("link", extractedFromMarkdown);
core.setOutput("markdown", shareLink);
core.setOutput("success", isPassed);

await core.summary
.addHeading("TestDriver.ai Results")
Expand Down
12 changes: 12 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
let exitcode = "0\n"

console.log(exitcode)
console.log(typeof exitcode)

const isPassed = parseInt(exitcode) === 0;

if (!isPassed) {
console.log('failed')
} else {
console.log('passed')
}
Loading