@@ -30776,8 +30776,7 @@ const getTest = async () => {
3077630776 const obj = JSON.parse(objStr);
3077730777 let failIds = [];
3077830778 obj.forEach((element) => {
30779- if (element.type == "testDone" &&
30780- element.result.toLowerCase() == "error") {
30779+ if (element.type == "testDone" && element.result.toLowerCase() == "error") {
3078130780 failIds.push(element.testID);
3078230781 }
3078330782 });
@@ -30791,18 +30790,14 @@ const getTest = async () => {
3079130790 const errorString = [];
3079230791 failIds.forEach((e1) => {
3079330792 const allEntries = obj.filter((e) => (e.hasOwnProperty("testID") && e.testID == e1) ||
30794- (e.hasOwnProperty("test") &&
30795- e.test.hasOwnProperty("id") &&
30796- e.test.id == e1));
30793+ (e.hasOwnProperty("test") && e.test.hasOwnProperty("id") && e.test.id == e1));
3079730794 const entry1 = allEntries.find((e) => e.hasOwnProperty("test") && e.test.hasOwnProperty("id"));
3079830795 let testName = "Error getting test name";
3079930796 if (entry1) {
3080030797 testName = entry1.test.name.split("/test/").slice(-1);
3080130798 }
3080230799 const entry2 = allEntries.find((e) => e.hasOwnProperty("stackTrace") && e.stackTrace.length > 1);
30803- const entry3 = allEntries.find((e) => e.hasOwnProperty("message") &&
30804- e.message.length > 1 &&
30805- e.message.includes("EXCEPTION CAUGHT BY FLUTTER"));
30800+ const entry3 = allEntries.find((e) => e.hasOwnProperty("message") && e.message.length > 1 && e.message.includes("EXCEPTION CAUGHT BY FLUTTER"));
3080630801 const entry4 = allEntries.find((e) => e.hasOwnProperty("error") && e.error.length > 1);
3080730802 let testDetails = "Unable to get test details. Run flutter test to replicate";
3080830803 if (entry2) {
@@ -30814,11 +30809,7 @@ const getTest = async () => {
3081430809 else if (entry4) {
3081530810 testDetails = entry4.error;
3081630811 }
30817- errorString.push("<details><summary>" +
30818- testName +
30819- "</br></summary>`" +
30820- testDetails +
30821- "`</details>");
30812+ errorString.push("<details><summary>" + testName + "</br></summary>`" + testDetails + "`</details>");
3082230813 });
3082330814 const output = `⛔️ - ${initialString}</br >
3082430815 <details><summary>See details</summary>
@@ -33152,17 +33143,25 @@ const setup_1 = __nccwpck_require__(9346);
3315233143const behind_1 = __nccwpck_require__(8890);
3315333144const push_1 = __nccwpck_require__(3662);
3315433145const run = async () => {
33155- const token = process.env.GITHUB_TOKEN || (0, core_1.getInput)("token");
33156- const octokit = (0, github_1.getOctokit)(token);
33157- const behindByStr = await (0, behind_1.checkBranchStatus)(octokit, github_1.context);
33158- await (0, setup_1.setup)();
33159- const oldCoverage = (0, coverage_1.getOldCoverage)();
33160- const analyzeStr = await (0, analyze_1.getAnalyze)();
33161- const testStr = await (0, runTests_1.getTest)();
33162- const coverageStr = await (0, coverage_1.getCoverage)(oldCoverage);
33163- const comment = (0, comment_1.createComment)(analyzeStr, testStr, coverageStr, behindByStr);
33164- (0, comment_1.postComment)(octokit, comment, github_1.context);
33165- await (0, push_1.push)();
33146+ try {
33147+ const token = process.env.GITHUB_TOKEN || (0, core_1.getInput)("token");
33148+ const octokit = (0, github_1.getOctokit)(token);
33149+ const behindByStr = await (0, behind_1.checkBranchStatus)(octokit, github_1.context);
33150+ await (0, setup_1.setup)();
33151+ const oldCoverage = (0, coverage_1.getOldCoverage)();
33152+ const analyzeStr = await (0, analyze_1.getAnalyze)();
33153+ const testStr = await (0, runTests_1.getTest)();
33154+ const coverageStr = await (0, coverage_1.getCoverage)(oldCoverage);
33155+ const comment = (0, comment_1.createComment)(analyzeStr, testStr, coverageStr, behindByStr);
33156+ (0, comment_1.postComment)(octokit, comment, github_1.context);
33157+ await (0, push_1.push)();
33158+ if (analyzeStr.error || testStr.error || coverageStr.error) {
33159+ (0, core_1.setFailed)(`${analyzeStr.output}\n${testStr.output}\n${coverageStr.output}`);
33160+ }
33161+ }
33162+ catch (err) {
33163+ (0, core_1.setFailed)(`Action failed with error ${err}`);
33164+ }
3316633165};
3316733166run();
3316833167
0 commit comments