Skip to content
Open
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
10 changes: 7 additions & 3 deletions client/shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
mochaOptions = mochaOptions || {
ui: 'bdd',
reporter: 'spec',
colors: true
color: true
};

mocha.setup(mochaOptions);
Expand Down Expand Up @@ -55,10 +55,14 @@

m.runner = origRun.apply(mocha, arguments);
if (m.runner.stats && m.runner.stats.end) {
window._eventbus.emit('ended', m.runner.stats);
setTimeout(()=>{
window._eventbus.emit('ended', m.runner.stats);
}, 2000)
Copy link
Owner

Choose a reason for hiding this comment

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

arbitrary timeouts are never a predictable or portable thing. two seconds is also a very long time. perhaps you're looking for a deferred promise?

Choose a reason for hiding this comment

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

Sorry, I didn't realise that we made the PR from our forks master branch. The timeout was meant as a temp solution for our system where chrome gets shutdown before the reporter finishes.

It would make sense to close this PR and use the other open one as it contains the same fixes: #45

} else {
m.runner.on('end', () => {
window._eventbus.emit('ended', m.runner.stats);
setTimeout(()=>{
window._eventbus.emit('ended', m.runner.stats);
}, 2000)
});
}
return m.runner;
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class MochaChrome {
mocha: {
reporter: 'spec',
ui: 'bdd',
colors: true
color: true
}
},
options
Expand Down
4 changes: 2 additions & 2 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ if (!/^(file|http(s?)):\/\//.test(file)) {
url = `file://${fs.realpathSync(file)}`;
}

const colors = !!flags.colors;
const color = !!flags.color;
const reporter = flags.reporter || 'spec';
const mocha = Object.assign(JSON.parse(flags.mocha || '{}'), { colors, reporter });
const mocha = Object.assign(JSON.parse(flags.mocha || '{}'), { color, reporter });
const chromeFlags = JSON.parse(flags.chromeFlags || '[]');
const {
chromeLauncher = {},
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mocha-chrome",
"version": "2.2.0",
"name": "digabi-mocha-chrome",
Copy link
Owner

Choose a reason for hiding this comment

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

I cant accept this change. I wouldn't recommend having your team commit to a fork branch that has an open PR

"version": "2.3.0",
"description": "☕ Run Mocha tests using headless Google Chrome",
"license": "MIT",
"repository": "shellscape/mocha-chrome",
Expand Down Expand Up @@ -31,6 +31,9 @@
"LICENSE",
"README.md"
],
"peerDependencies": {
"mocha": ">= 7.0.0"
},
"dependencies": {
"chalk": "^2.0.1",
"chrome-launcher": "^0.13.4",
Expand Down
2 changes: 1 addition & 1 deletion test/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function test(options) {
options = deepAssign(
(options = {
url,
mocha: { colors: false },
mocha: { color: false },
ignoreConsole: true,
ignoreExceptions: true,
ignoreResourceErrors: true
Expand Down