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

Unit test improvements #12153

Merged
merged 4 commits into from
Aug 1, 2020
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
91 changes: 67 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"gulp-rename": "^1.4.0",
"gulp-replace": "^1.0.0",
"gulp-zip": "^4.2.0",
"jasmine": "~3.5.0",
"jasmine": "^3.6.1",
"jsdoc": "^3.6.5",
"jstransformer-markdown-it": "^2.1.0",
"merge-stream": "^1.0.1",
Expand Down
30 changes: 23 additions & 7 deletions test/unit/testreporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,37 @@ var TestReporter = function (browser) {

this.jasmineStarted = function (suiteInfo) {
this.runnerStartTime = this.now();
sendInfo("Started tests for " + browser + ".");

const total = suiteInfo.totalSpecsDefined;
const seed = suiteInfo.order.seed;
sendInfo(`Started ${total} tests for ${browser} with seed ${seed}.`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really nice, and one of those things that you can't help but wonder why we haven't done years ago!

};

this.suiteStarted = function (result) {};
this.suiteStarted = function (result) {
// Normally suite starts don't have to be reported because the individual
// specs inside them are reported, but it can happen that the suite cannot
// start, for instance due to an uncaught exception in `beforeEach`. This
// is problematic because the specs inside the suite will never be found
// and run, so if we don't report the suite start failure here it would be
// ignored silently, leading to passing tests even though some did not run.
if (result.failedExpectations.length > 0) {
let failedMessages = "";
for (const item of result.failedExpectations) {
failedMessages += `${item.message} `;
}
sendResult("TEST-UNEXPECTED-FAIL", result.description, failedMessages);
}
};

this.specStarted = function (result) {};

this.specDone = function (result) {
if (result.failedExpectations.length === 0) {
sendResult("TEST-PASSED", result.description);
} else {
var failedMessages = "";
var items = result.failedExpectations;
for (var i = 0, ii = items.length; i < ii; i++) {
failedMessages += items[i].message + " ";
let failedMessages = "";
for (const item of result.failedExpectations) {
failedMessages += `${item.message} `;
}
sendResult("TEST-UNEXPECTED-FAIL", result.description, failedMessages);
}
Expand All @@ -71,7 +87,7 @@ var TestReporter = function (browser) {
this.suiteDone = function (result) {};

this.jasmineDone = function () {
// Give the test.py some time process any queued up requests
// Give the test runner some time process any queued requests.
setTimeout(sendQuitRequest, 500);
};
};