Skip to content

Check module queue existence when logging #1086

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
20 changes: 10 additions & 10 deletions lib/commands/exam.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,23 +309,23 @@ module.exports = TestCommand.extend({
const launcherId = this.launcher.id;
if (!failed && commands.get('loadBalance')) {
const browserId = getBrowserId(this.launcher);
log.info(
`Browser ${browserId} exiting. [ # of modules in current module queue ${
testemEvents.stateManager.getTestModuleQueue().length
} ]`
);
const moduleQueue = testemEvents.stateManager.getTestModuleQueue();
const noModuleQueue = 'testModuleQueue is not set.';
const numQueues =
moduleQueue !== null
? `[ # of modules in current module queue ${moduleQueue.length} ]`
: `[ ${noModuleQueue} ]`;
log.info(`Browser ${browserId} exiting. ${numQueues}`);
// if getBrowserId cannot get the browserId
// but the test queue is not empty, report the number of test modules left in the queue
// otherwise, fail because testModuleQueue was not set
if (browserId === 0) {
if (testemEvents.stateManager.getTestModuleQueue() !== null) {
if (moduleQueue !== null) {
ui.writeLine(
`[ # of modules in current module queue ${
testemEvents.stateManager.getTestModuleQueue().length
} ]`
`[ # of modules in current module queue ${moduleQueue.length} ]`
);
} else {
throw new Error('testModuleQueue is not set.');
throw new Error(noModuleQueue);
}
}
}
Expand Down