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

Ember exam failing when browser ID not found, return 0 #750

Merged
merged 4 commits into from
Oct 28, 2021
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
36 changes: 17 additions & 19 deletions lib/commands/exam.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,26 +292,24 @@ module.exports = TestCommand.extend({
const browserExitHandler = function (failed = false) {
const launcherId = this.launcher.id;
if (!failed && commands.get('loadBalance')) {
try {
const browserId = getBrowserId(this.launcher);
log.info(
`Browser ${browserId} exiting. [ # of modules in current module queue ${
testemEvents.stateManager.getTestModuleQueue().length
} ]`
);
} catch (err) {
const moduleQueueMessage =
testemEvents.stateManager.getTestModuleQueue() === null
? 'testModuleQueue is not set.'
: `[ # of modules in current module queue ${
testemEvents.stateManager.getTestModuleQueue().length
} ]`;

if (typeof err === 'object' && err !== null) {
err.message = `${err.message} \n ${moduleQueueMessage}`;
ui.writeLine(err.message);
const browserId = getBrowserId(this.launcher);
log.info(
`Browser ${browserId} exiting. [ # of modules in current module queue ${
testemEvents.stateManager.getTestModuleQueue().length
} ]`
);
// 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) {
ui.writeLine(
`[ # of modules in current module queue ${
testemEvents.stateManager.getTestModuleQueue().length
} ]`
);
} else {
throw new Error(moduleQueueMessage);
throw new Error('testModuleQueue is not set.');
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/test-page-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ function getBrowserId(launcher) {
const errMsg = `${err.message} \n${
err.stack
} \nLauncher Settings: ${JSON.stringify(launcher.settings, null, 2)}`;
throw new Error(errMsg);
console.warn(errMsg);
}
return 0;
}

/**
Expand Down