|
1 |
| - |
2 | 1 | (function () {
|
3 | 2 | 'use strict';
|
4 | 3 |
|
|
75 | 74 | fs.unlinkSync(this.summaryFile);
|
76 | 75 | }
|
77 | 76 |
|
78 |
| - const all = this.runningTotals; |
| 77 | + const all = this.runningTotals; |
79 | 78 |
|
80 | 79 | this.writeSummaryFile(`${this.bold}${this.cyan}================================================================================${this.reset}`);
|
81 | 80 | this.writeSummaryFile(`${this.bold}${this.cyan}Test Summary${this.reset}`);
|
|
106 | 105 |
|
107 | 106 | try {
|
108 | 107 |
|
109 |
| - this.writeFile(`${this.bold}${this.cyan}Test results for package ${this.bluebg} ${process.env.NG_TEST_SUITE} ${this.reset}`); |
110 |
| - this.writeFile(`Total : ${this.bold}${this.cyan}${this.total}${this.reset}`) |
111 |
| - this.writeFile(`Passed : ${this.bold}${this.cyan}${passed}${this.reset}`) |
112 |
| - this.writeFile(`Failed : ${this.bold}${this.red}${this.failed.length}${this.reset}`) |
113 |
| - this.writeFile(`Skipped : ${this.bold}${this.yellow}${this.skipped}${this.reset}`) |
114 |
| - |
115 |
| - if (this.failed.length === 0) { |
116 |
| - fs.appendFileSync(this.file, 'All tests passed\n') |
117 |
| - } else { |
118 |
| - this.writeFile('Test failures:'); |
119 |
| - this.failed.forEach(f => { |
120 |
| - this.writeFile(`${this.red}${this.bold} - ${f.fullName}${this.reset}`); |
121 |
| - const logs = f.log || []; |
122 |
| - logs.forEach(l => fs.appendFileSync(this.file, `${this.grey} ${l}${this.reset}`)); |
123 |
| - // Add empty line |
124 |
| - this.writeFile(''); |
125 |
| - }); |
126 |
| - } |
127 |
| - |
128 |
| - // Update running totals JSON |
129 |
| - this.runningTotals.total += this.total; |
130 |
| - this.runningTotals.passed += passed; |
131 |
| - this.runningTotals.failed += this.failed.length; |
132 |
| - this.runningTotals.skipped += this.skipped; |
133 |
| - fs.writeFileSync(this.jsonFile, JSON.stringify(this.runningTotals)); |
134 |
| - |
135 |
| - this.generateSummary(); |
136 |
| - |
137 |
| - // Write exit code |
138 |
| - let newExitCode = this.exitCode; |
139 |
| - if (result.exitCode > 0) { |
140 |
| - newExitCode = result.exitCode |
141 |
| - } |
142 |
| - |
143 |
| - fs.writeFileSync(this.exitCodeFile, newExitCode.toString()); |
144 |
| - |
145 |
| - // Dump the summary for this test suite |
146 |
| - var contents = fs.readFileSync(this.file, 'utf8'); |
147 |
| - console.log(contents); |
148 |
| - |
149 |
| - } catch(e) { |
| 108 | + this.writeFile(`${this.bold}${this.cyan}Test results for package ${this.bluebg} ${process.env.NG_TEST_SUITE} ${this.reset}`); |
| 109 | + this.writeFile(`Total : ${this.bold}${this.cyan}${this.total}${this.reset}`) |
| 110 | + this.writeFile(`Passed : ${this.bold}${this.cyan}${passed}${this.reset}`) |
| 111 | + this.writeFile(`Failed : ${this.bold}${this.red}${this.failed.length}${this.reset}`) |
| 112 | + this.writeFile(`Skipped : ${this.bold}${this.yellow}${this.skipped}${this.reset}`) |
| 113 | + |
| 114 | + if (this.failed.length === 0) { |
| 115 | + fs.appendFileSync(this.file, 'All tests passed\n') |
| 116 | + } else { |
| 117 | + this.writeFile('Test failures:'); |
| 118 | + this.failed.forEach(f => { |
| 119 | + this.writeFile(`${this.red}${this.bold} - ${f.fullName}${this.reset}`); |
| 120 | + const logs = f.log || []; |
| 121 | + logs.forEach(l => fs.appendFileSync(this.file, `${this.grey} ${l}${this.reset}`)); |
| 122 | + // Add empty line |
| 123 | + this.writeFile(''); |
| 124 | + }); |
| 125 | + } |
| 126 | + |
| 127 | + // Update running totals JSON |
| 128 | + this.runningTotals.total += this.total; |
| 129 | + this.runningTotals.passed += passed; |
| 130 | + this.runningTotals.failed += this.failed.length; |
| 131 | + this.runningTotals.skipped += this.skipped; |
| 132 | + fs.writeFileSync(this.jsonFile, JSON.stringify(this.runningTotals)); |
| 133 | + |
| 134 | + this.generateSummary(); |
| 135 | + |
| 136 | + // Write exit code |
| 137 | + let newExitCode = this.exitCode; |
| 138 | + if (result.exitCode > 0) { |
| 139 | + newExitCode = result.exitCode |
| 140 | + } |
| 141 | + |
| 142 | + fs.writeFileSync(this.exitCodeFile, newExitCode.toString()); |
| 143 | + |
| 144 | + // Dump the summary for this test suite |
| 145 | + var contents = fs.readFileSync(this.file, 'utf8'); |
| 146 | + console.log(contents); |
| 147 | + |
| 148 | + } catch (e) { |
150 | 149 | console.log('ERROR while reporting test result');
|
151 | 150 | console.log(e);
|
152 | 151 | }
|
|
0 commit comments