diff --git a/spec/static/index.html b/spec/static/index.html
index 49e3f102ef..336274a710 100644
--- a/spec/static/index.html
+++ b/spec/static/index.html
@@ -54,17 +54,6 @@
var mocha = new Mocha();
- if (isCi) {
- mocha.grep = function () {
- try {
- throw new Error('A spec contains a call to it.only or describe.only and should be reverted.')
- } catch (error) {
- console.error(error.stack || error)
- }
- ipcRenderer.send('process.exit', 1)
- }
- }
-
mocha.ui('bdd').reporter(isCi ? 'tap' : 'html');
var query = Mocha.utils.parseQuery(window.location.search || '');
@@ -83,6 +72,16 @@
walker.on('end', function() {
var runner = mocha.run(function() {
+ if (isCi && runner.hasOnly) {
+ try {
+ throw new Error('A spec contains a call to it.only or describe.only and should be reverted.')
+ } catch (error) {
+ console.error(error.stack || error)
+ }
+ ipcRenderer.send('process.exit', 1)
+ return
+ }
+
Mocha.utils.highlightTags('code');
var coverage = new Coverage({