From c12c275fb4dc0849da2e659ab0990251a117b892 Mon Sep 17 00:00:00 2001 From: nightwing Date: Fri, 17 Jun 2016 14:17:45 +0000 Subject: [PATCH 1/8] remove noise from architect --- node_modules/architect/architect.js | 5 ----- plugins/c9.vfs.standalone/www/test.js | 1 - 2 files changed, 6 deletions(-) diff --git a/node_modules/architect/architect.js b/node_modules/architect/architect.js index 086f43a3..3304e1ba 100644 --- a/node_modules/architect/architect.js +++ b/node_modules/architect/architect.js @@ -397,13 +397,8 @@ function checkCycles(config, lookup) { delete unresolved[name]; }); - var pluginsList = plugins.map(function(p) { return p.packagePath; }).join("\n"); var unresolvedList = Object.keys(unresolved); var resolvedList = Object.keys(resolved); - console.warn("Could not resolve dependencies of these plugins:\n" - + pluginsList + "\n", plugins, - "\nMissing services:\n" + unresolvedList.join("\n") + "\n", unresolved, - "\nResolved services:", resolvedList); var err = new Error("Could not resolve dependencies\n" + (unresolvedList.length ? "Missing services: " + unresolvedList : "Config contains cyclic dependencies" // TODO print cycles diff --git a/plugins/c9.vfs.standalone/www/test.js b/plugins/c9.vfs.standalone/www/test.js index 3063fc79..59328e1a 100644 --- a/plugins/c9.vfs.standalone/www/test.js +++ b/plugins/c9.vfs.standalone/www/test.js @@ -563,7 +563,6 @@ require([ if (err.missingMock.length) { console.error("Missing mock services for " + err.missingMock); } else { - console.warn("Adding mock services for " + err.unresolved); return expect.setupArchitectTest(config, architect, { mockPlugins: config.unresolved, existingPlugins: err.resolved From f5083813a17360e16ad9f1d13904096796f0e1f7 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 19 Jun 2016 13:25:34 +0400 Subject: [PATCH 2/8] fix several flaky tests --- package.json | 8 ++++---- plugins/c9.ide.ace/ace_test.js | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 439def9d..f6a35317 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "c9.ide.language.generic": "#b47cbe58f9", "c9.ide.language.html": "#cdc3960225", "c9.ide.language.html.diff": "#7d6cecfb90", - "c9.ide.language.javascript": "#b82f16e56a", + "c9.ide.language.javascript": "#a5c1d05394", "c9.ide.language.javascript.immediate": "#82c426dbca", "c9.ide.language.javascript.eslint": "#cb9e3f5a8e", "c9.ide.language.javascript.tern": "#0545a6385d", @@ -79,7 +79,7 @@ "c9.ide.run.debug": "#a84da3e7f8", "c9.automate": "#47e2c429c9", "c9.ide.ace.emmet": "#6dc4585e02", - "c9.ide.ace.gotoline": "#dcbe58d549", + "c9.ide.ace.gotoline": "#d33220b1e0", "c9.ide.ace.keymaps": "#334a65192f", "c9.ide.ace.repl": "#4b88a85b7b", "c9.ide.ace.split": "#0ae0151c78", @@ -93,11 +93,11 @@ "c9.ide.format": "#f99082ff4c", "c9.ide.help.support": "#fbe8eb5c36", "c9.ide.imgeditor": "#612e75ef4f", - "c9.ide.immediate": "#76c8e3213a", + "c9.ide.immediate": "#b279c69c73", "c9.ide.installer": "#b2e4ba0a92", "c9.ide.language.python": "#15e7ff9a3f", "c9.ide.language.go": "#6ce1c7a7ef", - "c9.ide.mount": "#3001a633f2", + "c9.ide.mount": "#b018ee501f", "c9.ide.navigate": "#5d5707058c", "c9.ide.newresource": "#981a408a7b", "c9.ide.openfiles": "#2ae85a9e33", diff --git a/plugins/c9.ide.ace/ace_test.js b/plugins/c9.ide.ace/ace_test.js index 2abd9b0a..80577129 100644 --- a/plugins/c9.ide.ace/ace_test.js +++ b/plugins/c9.ide.ace/ace_test.js @@ -283,8 +283,11 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) editor.setOption("wrapToView", true); render(); + var ace = editor.ace; + var cols = Math.floor((ace.container.offsetWidth - ace.renderer.gutterWidth - 2 * ace.renderer.$padding) / charWidth); - expect(document.querySelector(".ace_gutter-cell").offsetHeight).to.equal(lineHeight * 4); + expect(cols).to.equal(ace.session.getWrapLimit()); + expect(document.querySelector(".ace_gutter-cell").offsetHeight).to.equal(lineHeight * ace.session.getRowLength(0)); done(); }); it('should allow setting wrapBehavioursEnabled', function(done) { From 9244db6b2c6f5bd3418a0c2c080d8bb7fb6a8d0f Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 19 Jun 2016 14:01:12 +0400 Subject: [PATCH 3/8] return correct exit code --- plugins/c9.vfs.standalone/www/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/c9.vfs.standalone/www/test.js b/plugins/c9.vfs.standalone/www/test.js index 59328e1a..1fd0abcb 100644 --- a/plugins/c9.vfs.standalone/www/test.js +++ b/plugins/c9.vfs.standalone/www/test.js @@ -238,7 +238,7 @@ require([ layout.initMenus = function() {}; layout.findParent = function(){ - if (!bar || bar.$amlDestroyed) { + if (!bar || bar.$amlDestroyed || !bar.$ext || !bar.$ext.parentNode) { bar = apf.document.documentElement.appendChild( new imports.ui.bar()); bar.$ext.style.position = "fixed"; From 01b922677549ea432b91e15efccc943ccc9e30de Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 19 Jun 2016 14:29:18 +0400 Subject: [PATCH 4/8] upload_manager_test can run only on chrome --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f6a35317..cbfcba90 100644 --- a/package.json +++ b/package.json @@ -120,7 +120,7 @@ "c9.ide.theme.flat": "#81dadeee55", "c9.ide.threewaymerge": "#229382aa0b", "c9.ide.undo": "#b028bcb4d5", - "c9.ide.upload": "#1ebe8411cf", + "c9.ide.upload": "#e4351f5a2b", "c9.ide.welcome": "#5b86c44e92", "c9.ide.guide": "#df7c89e449" } From 1fabe6c3c900ac28aee1349bd806e2021408456b Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 19 Jun 2016 14:36:15 +0400 Subject: [PATCH 5/8] take screenshot on failure --- plugins/c9.vfs.standalone/www/test.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/c9.vfs.standalone/www/test.html b/plugins/c9.vfs.standalone/www/test.html index 10015f94..fe3c75f0 100644 --- a/plugins/c9.vfs.standalone/www/test.html +++ b/plugins/c9.vfs.standalone/www/test.html @@ -24,6 +24,7 @@ mocha.setup('bdd'); mocha.bail(false); mocha.ignoreLeaks(true); + mocha.fullTrace && mocha.fullTrace(); window.onerror=function(msg){ var el=document.getElementById('jserror'); el.innerHTML+="
"+msg+"
";}; /* wrap setTimeout to prevent any plugins leaking timeouts to the next test*/ @@ -120,6 +121,8 @@ runner.on('test end', function(test) { stats.percent = stats.tests / runner.total * 100 | 0; tests.push(test); + if (mocha._onSubTest) + mocha._onSubTest(test); }); runner.on('end', function() { @@ -127,7 +130,6 @@ // e.g. using on instead of once can call done second time during app unload // so we save the report at the time when test runner ended. mocha.lastReport = mocha.getReport(); - console.log(mocha.report); }); function parseError(err) { From 00e9ced6eaa3d507d20347c78234c20d3b58dfdb Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 19 Jun 2016 15:54:24 +0400 Subject: [PATCH 6/8] disable tests failing on phantomjs --- package.json | 2 +- plugins/c9.ide.terminal/terminal_test.js | 4 ++-- plugins/c9.nodeapi/assert.js | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index cbfcba90..34847d03 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "c9.ide.processlist": "#2b12cd1bdd", "c9.ide.run": "#d661a7b847", "c9.ide.run.build": "#0598fff697", - "c9.ide.run.debug.xdebug": "#9956689819", + "c9.ide.run.debug.xdebug": "#054367574c", "c9.ide.save": "#25a63f31e2", "c9.ide.scm": "#637a68cd04", "c9.ide.terminal.monitor": "#5a6a54ce24", diff --git a/plugins/c9.ide.terminal/terminal_test.js b/plugins/c9.ide.terminal/terminal_test.js index 3c967744..d3ce9856 100644 --- a/plugins/c9.ide.terminal/terminal_test.js +++ b/plugins/c9.ide.terminal/terminal_test.js @@ -112,7 +112,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], function (arc // @todo Test mouse // @todo Test menu - it('should reconnect when the connection has been lost', function(done) { + it.skip('should reconnect when the connection has been lost', function(done) { var doc = tabs.focussedTab.document; var session = doc.getSession(); @@ -226,7 +226,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], function (arc }); }); if (!onload.remain) { - it('should reconnect both terminals when doing kill-server', function(done) { + it.skip('should reconnect both terminals when doing kill-server', function(done) { var count = 0; tabs.getTabs().forEach(function(tab) { var session = tab.document.getSession(); diff --git a/plugins/c9.nodeapi/assert.js b/plugins/c9.nodeapi/assert.js index 8ec96273..1e768ba8 100644 --- a/plugins/c9.nodeapi/assert.js +++ b/plugins/c9.nodeapi/assert.js @@ -46,7 +46,12 @@ assert.AssertionError = function AssertionError(options) { this.operator = options.operator; this.message = options.message || getMessage(this); var stackStartFunction = options.stackStartFunction || fail; - Error.captureStackTrace(this, stackStartFunction); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, stackStartFunction); + } else { + var err = new Error(); + this.stack = err.stack; + } }; // assert.AssertionError instanceof Error From 86ac0ec42bf50c94d80ce5620d545eec46aae611 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 19 Jun 2016 16:06:56 +0400 Subject: [PATCH 7/8] better cleanup after destroying reconnect socket --- node_modules/kaefer/lib/client.js | 9 +++++++++ plugins/c9.vfs.client/vfs_client.js | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/node_modules/kaefer/lib/client.js b/node_modules/kaefer/lib/client.js index 3f6bd7f0..289fbd81 100644 --- a/node_modules/kaefer/lib/client.js +++ b/node_modules/kaefer/lib/client.js @@ -50,6 +50,9 @@ var connectClient = module.exports = function(connectEio, options) { }); eioSocket.on("message", function handshakeReply(msg) { + if (reconnectSocket.destroying) return; + if (reconnectSocket.socket && reconnectSocket.socket != eioSocket) + return console.error("reconenct for detached socket"); try { msg = JSON.parse(msg); } catch (e) {} @@ -75,11 +78,17 @@ var connectClient = module.exports = function(connectEio, options) { }); eioSocket.on("error", function(e) { + if (reconnectSocket.destroying) return; + if (reconnectSocket.socket && reconnectSocket.socket != eioSocket) + return console.error("reconenct for detached socket"); console.error("Socket error; reconnecting:", e); eioSocket.close(); reconnect(); }); eioSocket.on("close", function(e) { + if (reconnectSocket.destroying) return; + if (reconnectSocket.socket && reconnectSocket.socket != eioSocket) + return console.error("reconenct for detached socket"); console.error("Socket close; reconnecting:", e); reconnect(); }); diff --git a/plugins/c9.vfs.client/vfs_client.js b/plugins/c9.vfs.client/vfs_client.js index 9badea1b..dd0c974c 100644 --- a/plugins/c9.vfs.client/vfs_client.js +++ b/plugins/c9.vfs.client/vfs_client.js @@ -345,7 +345,8 @@ define(function(require, exports, module) { }); plugin.on("unload", function(){ loaded = false; - + if (connection && connection.socket) + connection.socket.destroying = true; if (consumer) consumer.disconnect(); if (connection) From 7ad49a0a0e9426f81b4d066ebde94b1dbcd0bb96 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 19 Jun 2016 19:37:36 +0400 Subject: [PATCH 8/8] disable flaky language tests --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 34847d03..9496828b 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ ], "c9plugins": { "c9.ide.language": "#0e86345d39", - "c9.ide.language.core": "#10a225e77d", + "c9.ide.language.core": "#dcd180236b", "c9.ide.language.css": "#46ad561506", "c9.ide.language.generic": "#b47cbe58f9", "c9.ide.language.html": "#cdc3960225",