Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/thsmi/sieve.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThomas Schmid <schmid-thomas@gmx.net>2020-05-30 14:03:04 +0300
committerThomas Schmid <schmid-thomas@gmx.net>2020-05-30 14:03:04 +0300
commitcefee33da6894eedf5e5e803581c4ad20611c3df (patch)
tree66900e6d27698877de0c12bc60c3ed186487fab1 /tests
parent90cbd6c7933ea9b1f81df64593f43b785f312f7c (diff)
Display a summary at the end of the tests
Diffstat (limited to 'tests')
-rw-r--r--tests/index.js5
-rw-r--r--tests/js/common/AbstractTestReport.js4
-rw-r--r--tests/js/common/AbstractTestSuite.js4
-rw-r--r--tests/js/node/NodeTestReport.js26
4 files changed, 33 insertions, 6 deletions
diff --git a/tests/index.js b/tests/index.js
index 198a188d..a4192131 100644
--- a/tests/index.js
+++ b/tests/index.js
@@ -20,12 +20,9 @@ async function main() {
await writeFile("./test.log.xml", (new JUnitExporter()).export(report));
- // TODO Print a summary
- // report.summary();
- console.log(` Ran ${report.getReports().length} fixtures xx failed xx errored`);
+ report.summary();
if (report.hasFailed()) {
- console.log("Some Tests failed.");
process.exit(1);
}
}
diff --git a/tests/js/common/AbstractTestReport.js b/tests/js/common/AbstractTestReport.js
index 9ccb2036..547d8726 100644
--- a/tests/js/common/AbstractTestReport.js
+++ b/tests/js/common/AbstractTestReport.js
@@ -336,10 +336,10 @@
if (this.status === STATUS_FIXTURE_ERROR)
return true;
- if (this.getFailures())
+ if (this.getFailures().length)
return true;
- if (this.getErrors())
+ if (this.getErrors().length)
return true;
return false;
diff --git a/tests/js/common/AbstractTestSuite.js b/tests/js/common/AbstractTestSuite.js
index d8b61f53..a441a7f7 100644
--- a/tests/js/common/AbstractTestSuite.js
+++ b/tests/js/common/AbstractTestSuite.js
@@ -306,10 +306,14 @@
*/
async run(report) {
+ report.start();
+
for (const fixture of this.tests) {
await fixture.run(report);
}
+ report.stop();
+
return this;
}
diff --git a/tests/js/node/NodeTestReport.js b/tests/js/node/NodeTestReport.js
index 94c06d00..933780e8 100644
--- a/tests/js/node/NodeTestReport.js
+++ b/tests/js/node/NodeTestReport.js
@@ -166,6 +166,32 @@
return new NodeTestFixtureReport(name, this.getLogger());
}
+ /**
+ * Prints a summary
+ */
+ summary() {
+ let total = 0;
+ let failures = 0;
+ let errors = 0;
+
+ for (const report of this.getReports()) {
+ total += report.getReports().length;
+ failures += report.getFailures().length;
+ errors += report.getErrors().length;
+ }
+
+ const fixtures = this.getReports().length;
+ const duration = this.getDuration();
+
+ this.getLogger().header("Summary");
+ this.getLogger().logInfo(
+ `Ran ${fixtures} fixtures with ${total} Tests in ${duration} ms.`);
+
+ if (this.hasFailed())
+ this.getLogger().logError(`${failures} tests failed ${errors} test errored`);
+
+ }
+
}
exports.NodeTestReport = NodeTestSuiteReport;