From 6b1a1c9ee888748602969f024d99fb67ba36bec3 Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Wed, 18 Nov 2015 16:15:35 +0000 Subject: [PATCH 01/57] the response might have already been sent fixes https://github.com/c9/newclient/issues/10438 --- node_modules/vfs-http-adapter/restful.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/node_modules/vfs-http-adapter/restful.js b/node_modules/vfs-http-adapter/restful.js index 62201003..0a76dd5a 100644 --- a/node_modules/vfs-http-adapter/restful.js +++ b/node_modules/vfs-http-adapter/restful.js @@ -11,6 +11,9 @@ module.exports = function setup(mount, vfs, mountOptions) { var errorHandler = mountOptions.errorHandler || function (req, res, err, code) { console.error(err.stack || err); + if (res.headersSent) + return; + if (code) res.statusCode = code; else if (typeof err.code == "number") res.statusCode = err.code; else if (err.code === "EBADREQUEST") res.statusCode = 400; From 3b50f576dea07fecd13ff198baa2d209661a2d54 Mon Sep 17 00:00:00 2001 From: Tim Robinson Date: Fri, 20 Nov 2015 19:54:47 +0000 Subject: [PATCH 02/57] Increasing test timeouts --- package.json | 8 ++++---- plugins/c9.ide.editors/tabmanager_test.js | 2 ++ plugins/c9.ide.preferences/preferences_test.js | 5 ++--- plugins/c9.vfs.client/vfs_test.js | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index d04f4cde..459fe642 100644 --- a/package.json +++ b/package.json @@ -63,12 +63,12 @@ "c9.ide.language.javascript": "#2b77bdb96a", "c9.ide.language.javascript.immediate": "#0535804ada", "c9.ide.language.javascript.eslint": "#3ec4557969", - "c9.ide.language.javascript.tern": "#40cf04bded", + "c9.ide.language.javascript.tern": "#468cc173c4", "c9.ide.language.javascript.infer": "#8478e3c702", "c9.ide.language.jsonalyzer": "#8401c240b3", "c9.ide.collab": "#5d9400830d", "c9.ide.local": "#a6e689e33b", - "c9.ide.find": "#35379124ca", + "c9.ide.find": "#e33fbaed2f", "c9.ide.find.infiles": "#c3bf17286d", "c9.ide.find.replace": "#8cbce45290", "c9.ide.run.debug": "#dbe6c81252", @@ -105,7 +105,7 @@ "c9.ide.run": "#c0b6677da6", "c9.ide.run.build": "#0598fff697", "c9.ide.run.debug.xdebug": "#5c004d2d75", - "c9.ide.save": "#5118b30230", + "c9.ide.save": "#a2820d0ea1", "c9.ide.scm": "#27ac592b33", "c9.ide.terminal.monitor": "#35afa7f97f", "c9.ide.test": "#93be8f1f26", @@ -114,6 +114,6 @@ "c9.ide.threewaymerge": "#229382aa0b", "c9.ide.undo": "#b028bcb4d5", "c9.ide.upload": "#0bd010d3dc", - "c9.ide.welcome": "#7450aebef6" + "c9.ide.welcome": "#437071b819" } } \ No newline at end of file diff --git a/plugins/c9.ide.editors/tabmanager_test.js b/plugins/c9.ide.editors/tabmanager_test.js index fcd05eb0..fe92c662 100644 --- a/plugins/c9.ide.editors/tabmanager_test.js +++ b/plugins/c9.ide.editors/tabmanager_test.js @@ -89,6 +89,8 @@ require(["lib/architect/architect", "lib/chai/chai"], }); describe('tabs', function() { + this.timeout(20000); + before(function(done) { apf.config.setProperty("allow-select", false); apf.config.setProperty("allow-blur", false); diff --git a/plugins/c9.ide.preferences/preferences_test.js b/plugins/c9.ide.preferences/preferences_test.js index cd892555..874e41ce 100644 --- a/plugins/c9.ide.preferences/preferences_test.js +++ b/plugins/c9.ide.preferences/preferences_test.js @@ -96,6 +96,8 @@ require([ }); describe('preferences', function() { + this.timeout(20000); + before(function(done) { apf.config.setProperty("allow-select", false); apf.config.setProperty("allow-blur", false); @@ -113,7 +115,6 @@ require([ var plugin = new Plugin(); describe("addSettings", function(){ - this.timeout(10000); it('should open a pane with just an editor', function(done) { settings.set("user/general/keybindings/@preset", "custom"); @@ -173,8 +174,6 @@ require([ }); }); describe("unload()", function(){ - this.timeout(10000) - it('should unload the preferences', function(done) { general.unload(); prefs.unload(); diff --git a/plugins/c9.vfs.client/vfs_test.js b/plugins/c9.vfs.client/vfs_test.js index aedcbbe7..b9de9782 100644 --- a/plugins/c9.vfs.client/vfs_test.js +++ b/plugins/c9.vfs.client/vfs_test.js @@ -40,7 +40,7 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) var c9 = imports.c9; describe('vfs', function() { - this.timeout(20000); + this.timeout(30000); beforeEach(function(done) { if (vfs.connected) From 3b82ac26872f425ca27881a7bf9681c171417054 Mon Sep 17 00:00:00 2001 From: c9bot Date: Fri, 20 Nov 2015 20:55:14 +0100 Subject: [PATCH 03/57] c9-auto-bump 3.1.471 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 459fe642..ee9bc779 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.470", + "version": "3.1.471", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From acacbc4ae41f2a210683834f70557a28f2b23050 Mon Sep 17 00:00:00 2001 From: Tim Robinson Date: Fri, 20 Nov 2015 21:26:01 +0000 Subject: [PATCH 04/57] Increasing test timeout of metadata_test --- plugins/c9.ide.editors/metadata_test.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/c9.ide.editors/metadata_test.js b/plugins/c9.ide.editors/metadata_test.js index 8c724151..d8a1501a 100644 --- a/plugins/c9.ide.editors/metadata_test.js +++ b/plugins/c9.ide.editors/metadata_test.js @@ -108,6 +108,8 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], }); describe('metadata', function() { + this.timeout(20000); + before(function(done) { apf.config.setProperty("allow-select", false); apf.config.setProperty("allow-blur", false); From 1259bc016d94d7371e46d8b1a26b0d598ca79c61 Mon Sep 17 00:00:00 2001 From: c9bot Date: Fri, 20 Nov 2015 22:26:34 +0100 Subject: [PATCH 05/57] c9-auto-bump 3.1.472 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ee9bc779..139f3db0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.471", + "version": "3.1.472", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From 2a94be92564e79ed35f786be7ff5c8d6dc885cb0 Mon Sep 17 00:00:00 2001 From: c9bot Date: Sat, 21 Nov 2015 01:38:14 +0100 Subject: [PATCH 06/57] c9-auto-bump 3.1.473 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 139f3db0..71402e46 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.472", + "version": "3.1.473", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From 888ea0cfcf47c74567d03a88096bf549ea6d26e3 Mon Sep 17 00:00:00 2001 From: c9bot Date: Mon, 23 Nov 2015 11:07:07 +0100 Subject: [PATCH 07/57] c9-auto-bump 3.1.474 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 71402e46..48380a6e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.473", + "version": "3.1.474", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From f18077cd9befac911daca524b589e50e39cf244d Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Mon, 23 Nov 2015 11:41:21 +0000 Subject: [PATCH 08/57] fix: Cannot call method 'setUser' of undefined fixes https://github.com/c9/newclient/issues/10691 --- plugins/c9.error/raygun.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/c9.error/raygun.js b/plugins/c9.error/raygun.js index 6ceecb36..6a51ce0b 100644 --- a/plugins/c9.error/raygun.js +++ b/plugins/c9.error/raygun.js @@ -61,7 +61,7 @@ function plugin(options, imports, register) { errorClient: clients.error, warningClient: clients.warning, customClient: function(name) { - return client[name]; + return clients[name]; }, customData: customData } From be197e2f79d5d02e035c2e1b0bd295400ac6cf9d Mon Sep 17 00:00:00 2001 From: c9bot Date: Mon, 23 Nov 2015 12:45:29 +0100 Subject: [PATCH 09/57] c9-auto-bump 3.1.475 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 48380a6e..fbbbe308 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.474", + "version": "3.1.475", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From a04bf0c463db0c733c794e9215beab85df739ca4 Mon Sep 17 00:00:00 2001 From: c9bot Date: Mon, 23 Nov 2015 12:45:50 +0100 Subject: [PATCH 10/57] c9-auto-bump 3.1.476 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fbbbe308..abc70a7d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.475", + "version": "3.1.476", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From 9ea2d8ed6a882eff34ba351cb929102e8793cb28 Mon Sep 17 00:00:00 2001 From: c9bot Date: Mon, 23 Nov 2015 13:34:52 +0100 Subject: [PATCH 11/57] c9-auto-bump 3.1.477 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index abc70a7d..ee9aae6d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.476", + "version": "3.1.477", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From 5974323cfcfcae4c0004dd2233188aa019f00503 Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Mon, 23 Nov 2015 13:29:05 +0000 Subject: [PATCH 12/57] also call res.end --- node_modules/vfs-http-adapter/restful.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/node_modules/vfs-http-adapter/restful.js b/node_modules/vfs-http-adapter/restful.js index 0a76dd5a..1360f757 100644 --- a/node_modules/vfs-http-adapter/restful.js +++ b/node_modules/vfs-http-adapter/restful.js @@ -11,8 +11,10 @@ module.exports = function setup(mount, vfs, mountOptions) { var errorHandler = mountOptions.errorHandler || function (req, res, err, code) { console.error(err.stack || err); - if (res.headersSent) + if (res.headersSent) { + res.end(""); return; + } if (code) res.statusCode = code; else if (typeof err.code == "number") res.statusCode = err.code; From eabee0ebead35e90dd30d9a9ea3daa5d1513cd02 Mon Sep 17 00:00:00 2001 From: c9bot Date: Mon, 23 Nov 2015 14:29:19 +0100 Subject: [PATCH 13/57] c9-auto-bump 3.1.478 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ee9aae6d..e1f49a6b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.477", + "version": "3.1.478", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From ead490a2db26a354a4ca0bae91a57aef89410848 Mon Sep 17 00:00:00 2001 From: c9bot Date: Mon, 23 Nov 2015 15:23:14 +0100 Subject: [PATCH 14/57] c9-auto-bump 3.1.479 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e1f49a6b..a52adbee 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.478", + "version": "3.1.479", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From a612e5e9e0feac23662c8020fc61a166559df3fd Mon Sep 17 00:00:00 2001 From: c9bot Date: Mon, 23 Nov 2015 15:45:35 +0100 Subject: [PATCH 15/57] c9-auto-bump 3.1.480 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a52adbee..3e63cef1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.479", + "version": "3.1.480", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From c4c53a3d06802c7abf484486bc4dfefb9e23895e Mon Sep 17 00:00:00 2001 From: c9bot Date: Mon, 23 Nov 2015 15:46:18 +0100 Subject: [PATCH 16/57] c9-auto-bump 3.1.481 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3e63cef1..f1d61e31 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.480", + "version": "3.1.481", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From 7c80c143091c85f036276c603bbd73131e2bb20e Mon Sep 17 00:00:00 2001 From: c9bot Date: Mon, 23 Nov 2015 15:58:33 +0100 Subject: [PATCH 17/57] c9-auto-bump 3.1.482 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f1d61e31..06d79d8e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.481", + "version": "3.1.482", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From 973e6fc51d5252cada9792421c08e0a11c46d84a Mon Sep 17 00:00:00 2001 From: Dana Date: Mon, 16 Nov 2015 15:25:26 +0000 Subject: [PATCH 18/57] Changes signature of addTrait and adds filtering for test users --- node_modules/c9/has-internal-test-name.js | 20 ++++++++ .../c9/has-internal-test-name_test.js | 47 +++++++++++++++++++ node_modules/c9/skip-analytics.js | 4 +- 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 node_modules/c9/has-internal-test-name.js create mode 100644 node_modules/c9/has-internal-test-name_test.js diff --git a/node_modules/c9/has-internal-test-name.js b/node_modules/c9/has-internal-test-name.js new file mode 100644 index 00000000..72c7413b --- /dev/null +++ b/node_modules/c9/has-internal-test-name.js @@ -0,0 +1,20 @@ +if (define === undefined) { + var define = function(fn) { + fn(require, exports, module); + }; +} + +define(function(require, exports, module) { + "use strict"; + + var internalTestNames = ["c9test", "c9 test"]; + var regex = new RegExp(".*(" + internalTestNames.join("|") + ").*", "g"); + + function hasInternalTestName(name) { + if (!name) return false; + + return regex.test(name); + } + + module.exports = hasInternalTestName; +}); \ No newline at end of file diff --git a/node_modules/c9/has-internal-test-name_test.js b/node_modules/c9/has-internal-test-name_test.js new file mode 100644 index 00000000..3909cf93 --- /dev/null +++ b/node_modules/c9/has-internal-test-name_test.js @@ -0,0 +1,47 @@ +"use strict"; +"use mocha"; + +require("c9/inline-mocha")(module); +var assert = require("assert"); +var faker = require("faker"); +var hasInternalTestName= require("c9/has-internal-test-name"); + +describe("has-internal-test-name", function() { + + it("returns false when undefined name", function() { + var name; + + assert.equal(false, hasInternalTestName(name), "should return false when name undefined"); + }); + + it("returns true when name contains c9test", function() { + var name = "c9testjkdfkfd"; + assert.equal(true, hasInternalTestName(name), "should return true when name contains c9test"); + + name = "c9test jjkdfhfkjfdh"; + assert.equal(true, hasInternalTestName(name), "should return true when name contains c9test"); + + name = " c9testjhrrj"; + assert.equal(true, hasInternalTestName(name), "should return true when name contains c9test"); + + name = " c9testjhrrj ffjh"; + assert.equal(true, hasInternalTestName(name), "should return true when name contains c9test"); + }); + + it("returns true when name contains c9 test", function() { + var name = "c9 test dkjfdgjhfgdfk"; + assert.equal(true, hasInternalTestName(name), "should return true when name contains c9 test"); + + name = "c9 testdkjfdgjhfgdfk"; + assert.equal(true, hasInternalTestName(name), "should return true when name contains c9 test"); + + name = " c9 test dkjfdgjhfgdfk "; + assert.equal(true, hasInternalTestName(name), "should return true when name contains c9 test"); + }); + + it("returns false when not internal user test name", function() { + var name = faker.name.firstName(); + + assert.equal(false, hasInternalTestName(name), "should return false when name is not for internal testing"); + }); +}); \ No newline at end of file diff --git a/node_modules/c9/skip-analytics.js b/node_modules/c9/skip-analytics.js index 7362fd63..7133131c 100644 --- a/node_modules/c9/skip-analytics.js +++ b/node_modules/c9/skip-analytics.js @@ -6,12 +6,14 @@ if (define === undefined) { define(function(require, exports, module) { "use strict"; - + var hasInternalDomain = require("c9/has-internal-domain"); + var hasInternalTestName = require("c9/has-internal-test-name"); function skipAnalytics(user) { if (!user) return true; if (user.id === -1) return true; + if (hasInternalTestName(user.name)) return true; if (hasInternalDomain(user.email)) return true; return false; } From 94c568a5328244c53d5c37b003b9e84dac46a46d Mon Sep 17 00:00:00 2001 From: Dana Date: Mon, 23 Nov 2015 09:43:34 +0000 Subject: [PATCH 19/57] Fixes regex and tests --- node_modules/c9/has-internal-test-name.js | 2 +- .../c9/has-internal-test-name_test.js | 15 ++++++--------- node_modules/c9/skip-analytics.js | 1 + node_modules/c9/skip-analytics_test.js | 19 +++++++++++++++++++ 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/node_modules/c9/has-internal-test-name.js b/node_modules/c9/has-internal-test-name.js index 72c7413b..9b99f096 100644 --- a/node_modules/c9/has-internal-test-name.js +++ b/node_modules/c9/has-internal-test-name.js @@ -8,7 +8,7 @@ define(function(require, exports, module) { "use strict"; var internalTestNames = ["c9test", "c9 test"]; - var regex = new RegExp(".*(" + internalTestNames.join("|") + ").*", "g"); + var regex = new RegExp("^(" + internalTestNames.join("|") + ")+"); function hasInternalTestName(name) { if (!name) return false; diff --git a/node_modules/c9/has-internal-test-name_test.js b/node_modules/c9/has-internal-test-name_test.js index 3909cf93..9e5dff4c 100644 --- a/node_modules/c9/has-internal-test-name_test.js +++ b/node_modules/c9/has-internal-test-name_test.js @@ -15,27 +15,24 @@ describe("has-internal-test-name", function() { }); it("returns true when name contains c9test", function() { - var name = "c9testjkdfkfd"; + var name = "c9testregnjkdfkfd"; assert.equal(true, hasInternalTestName(name), "should return true when name contains c9test"); - name = "c9test jjkdfhfkjfdh"; + name = "c9test01"; assert.equal(true, hasInternalTestName(name), "should return true when name contains c9test"); - name = " c9testjhrrj"; - assert.equal(true, hasInternalTestName(name), "should return true when name contains c9test"); - - name = " c9testjhrrj ffjh"; + name = "c9testjhrrj ffjh"; assert.equal(true, hasInternalTestName(name), "should return true when name contains c9test"); }); - + it("returns true when name contains c9 test", function() { var name = "c9 test dkjfdgjhfgdfk"; assert.equal(true, hasInternalTestName(name), "should return true when name contains c9 test"); - name = "c9 testdkjfdgjhfgdfk"; + name = "c9 test07"; assert.equal(true, hasInternalTestName(name), "should return true when name contains c9 test"); - name = " c9 test dkjfdgjhfgdfk "; + name = "c9 testdkjfdgjhfgdfk"; assert.equal(true, hasInternalTestName(name), "should return true when name contains c9 test"); }); diff --git a/node_modules/c9/skip-analytics.js b/node_modules/c9/skip-analytics.js index 7133131c..108f8a76 100644 --- a/node_modules/c9/skip-analytics.js +++ b/node_modules/c9/skip-analytics.js @@ -13,6 +13,7 @@ define(function(require, exports, module) { function skipAnalytics(user) { if (!user) return true; if (user.id === -1) return true; + if (hasInternalTestName(user.name)) return true; if (hasInternalDomain(user.email)) return true; return false; diff --git a/node_modules/c9/skip-analytics_test.js b/node_modules/c9/skip-analytics_test.js index 300251b0..bfaf1215 100644 --- a/node_modules/c9/skip-analytics_test.js +++ b/node_modules/c9/skip-analytics_test.js @@ -22,6 +22,25 @@ describe("skip-analytics", function() { assert.equal(true, skipAnalytics(user), "skipAnalytics should return true when user id is -1"); }); + + it("returns false when user does not have an internal test name and no email", function() { + var user = { + id: faker.random.uuid(), + name: faker.name.firstName() + }; + + assert.equal(false, skipAnalytics(user), "skipAnalytics should return false when user does not have an internal test name and no email"); + }); + + it("returns true when user has an internal test name and no email", function() { + var user = { + id: faker.random.uuid(), + name: "c9test07" + }; + + assert.equal(true, skipAnalytics(user), "skipAnalytics should return true when user has an internal test name and no email"); + }); + it("returns false when user has no email", function() { var user = { id: faker.random.uuid() From 134eeaf0fcfa039055e2b45ed31ab552aeeab51f Mon Sep 17 00:00:00 2001 From: Dana Date: Mon, 23 Nov 2015 14:19:53 +0000 Subject: [PATCH 20/57] Adds further filtering --- node_modules/c9/has-internal-test-name.js | 8 +++++--- node_modules/c9/skip-analytics.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/node_modules/c9/has-internal-test-name.js b/node_modules/c9/has-internal-test-name.js index 9b99f096..82f65452 100644 --- a/node_modules/c9/has-internal-test-name.js +++ b/node_modules/c9/has-internal-test-name.js @@ -10,10 +10,12 @@ define(function(require, exports, module) { var internalTestNames = ["c9test", "c9 test"]; var regex = new RegExp("^(" + internalTestNames.join("|") + ")+"); - function hasInternalTestName(name) { - if (!name) return false; + function hasInternalTestName(user) { + if (!user.name && !user.username) return false; + + var testedName = user.name ? user.name : user.username; - return regex.test(name); + return regex.test(testedName); } module.exports = hasInternalTestName; diff --git a/node_modules/c9/skip-analytics.js b/node_modules/c9/skip-analytics.js index 108f8a76..9d6f4850 100644 --- a/node_modules/c9/skip-analytics.js +++ b/node_modules/c9/skip-analytics.js @@ -14,7 +14,7 @@ define(function(require, exports, module) { if (!user) return true; if (user.id === -1) return true; - if (hasInternalTestName(user.name)) return true; + if (hasInternalTestName(user)) return true; if (hasInternalDomain(user.email)) return true; return false; } From 16be016d0b037f2fa87bd13ffb944be34d10a74f Mon Sep 17 00:00:00 2001 From: Matthijs van Henten Date: Mon, 23 Nov 2015 15:20:32 +0000 Subject: [PATCH 21/57] remove flaky test --- plugins/c9.core/c9_test.js | 94 -------------------------------------- 1 file changed, 94 deletions(-) delete mode 100644 plugins/c9.core/c9_test.js diff --git a/plugins/c9.core/c9_test.js b/plugins/c9.core/c9_test.js deleted file mode 100644 index bdd0049b..00000000 --- a/plugins/c9.core/c9_test.js +++ /dev/null @@ -1,94 +0,0 @@ -/*global describe:false, it:false */ - -"use client"; - -require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) { - var expect = chai.expect; - - expect.setupArchitectTest([ - { - packagePath: "plugins/c9.core/c9", - startdate: new Date(), - debug: 2, - hosted: true, - local: false - }, - "plugins/c9.vfs.client/vfs_client", - "plugins/c9.vfs.client/endpoint", - "plugins/c9.ide.auth/auth", - "plugins/c9.core/api", - "plugins/c9.core/ext", - "plugins/c9.core/http-xhr", - { - consumes: [], - provides: ["auth.bootstrap", "info", "dialog.error"], - setup: expect.html.mocked - }, - - { - consumes: ["c9", "vfs"], - provides: [], - setup: main - } - ], architect); - - function main(options, imports, register) { - var c9 = imports.c9; - var vfs = imports.vfs; - - describe('c9', function() { - this.timeout(30000); - - it('should send proper events during connecting', function(done) { - // var count = 0; - - // c9.on("connecting", function c1(){ - // count++; - - // expect(c9.connecting).to.equal(true); - // expect(c9.connected).to.equal(false); - // expect(c9.has(c9.NETWORK)).to.equal(false); - - // c9.off("connecting", c1); - // }); - - expect(c9.connected).to.equal(false); - - c9.once("connect", function c2(){ - // expect(count, "Connecting event was not called").to.equal(1); - expect(c9.connected).to.equal(true); - expect(c9.has(c9.NETWORK)).to.equal(true); - - done(); - }); - - c9.enable(); - }); - it('check status settings and getting', function(done) { - c9.setStatus(c9.status & ~c9.STORAGE); - expect(c9.has(c9.STORAGE)).to.equal(false); - c9.setStatus(c9.status | c9.STORAGE); - expect(c9.has(c9.STORAGE)).to.equal(true); - done(); - }); - it('should send correct events during away', function(done) { - expect(c9.connected).to.equal(true); - expect(c9.has(c9.NETWORK)).to.equal(true); - - c9.once("away", function c1(){ - expect(c9.connected).to.equal(false); - expect(c9.has(c9.NETWORK)).to.equal(true); - }); - c9.once("back", function c1(){ - expect(c9.connected).to.equal(true); - expect(c9.has(c9.NETWORK)).to.equal(true); - done(); - }); - - vfs.connection.socket.close(); - }); - }); - - onload && onload(); - } -}); \ No newline at end of file From ba1416b8a2810ce0ef42516ddf08c2a2b1a81522 Mon Sep 17 00:00:00 2001 From: c9bot Date: Mon, 23 Nov 2015 16:31:06 +0100 Subject: [PATCH 22/57] c9-auto-bump 3.1.483 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 06d79d8e..23e5fb5d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.482", + "version": "3.1.483", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From 0886ad47bf51e565c7230879b1ca63f0ffab33fa Mon Sep 17 00:00:00 2001 From: Matthijs van Henten Date: Mon, 23 Nov 2015 15:44:35 +0000 Subject: [PATCH 23/57] disables a test that times out a lot --- plugins/c9.vfs.client/vfs_test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/c9.vfs.client/vfs_test.js b/plugins/c9.vfs.client/vfs_test.js index b9de9782..66c90836 100644 --- a/plugins/c9.vfs.client/vfs_test.js +++ b/plugins/c9.vfs.client/vfs_test.js @@ -1,5 +1,6 @@ /*global describe it before beforeEach*/ +"use blacklist"; "use client"; require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) { From 28f8bcc1b3c8e48485cc8d1af4716c5dda1607d8 Mon Sep 17 00:00:00 2001 From: c9bot Date: Mon, 23 Nov 2015 16:49:44 +0100 Subject: [PATCH 24/57] c9-auto-bump 3.1.484 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 23e5fb5d..f14f9a8c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.483", + "version": "3.1.484", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From d980692c30d272f235204f7823aa32b11c5403ea Mon Sep 17 00:00:00 2001 From: Matthijs van Henten Date: Mon, 23 Nov 2015 16:07:11 +0000 Subject: [PATCH 25/57] blacklist more tests --- package.json | 2 +- plugins/c9.fs/fs.cache.xml_test.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index f14f9a8c..04342648 100644 --- a/package.json +++ b/package.json @@ -114,6 +114,6 @@ "c9.ide.threewaymerge": "#229382aa0b", "c9.ide.undo": "#b028bcb4d5", "c9.ide.upload": "#0bd010d3dc", - "c9.ide.welcome": "#437071b819" + "c9.ide.welcome": "#336862828d" } } \ No newline at end of file diff --git a/plugins/c9.fs/fs.cache.xml_test.js b/plugins/c9.fs/fs.cache.xml_test.js index 9b574e45..dd8b93d8 100644 --- a/plugins/c9.fs/fs.cache.xml_test.js +++ b/plugins/c9.fs/fs.cache.xml_test.js @@ -1,5 +1,6 @@ /*global describe it before*/ +"use blacklist"; "use client"; require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "events"], From 39987cfefb7bd7b9ba8fbc086f6f381c3d6b4f93 Mon Sep 17 00:00:00 2001 From: c9bot Date: Mon, 23 Nov 2015 17:09:54 +0100 Subject: [PATCH 26/57] c9-auto-bump 3.1.485 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f14f9a8c..b47c523d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.484", + "version": "3.1.485", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From 3d1be6ecc6e27f1f7027466551a56a95f235dd7a Mon Sep 17 00:00:00 2001 From: c9bot Date: Mon, 23 Nov 2015 17:12:01 +0100 Subject: [PATCH 27/57] c9-auto-bump 3.1.486 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d732d6d4..18688bd0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.485", + "version": "3.1.486", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From 5572b4f10118bb8d13d2e8281c7bef84a81bb730 Mon Sep 17 00:00:00 2001 From: Matthijs van Henten Date: Mon, 23 Nov 2015 16:19:46 +0000 Subject: [PATCH 28/57] fixes +10369 silence the warnings --- node_modules/c9/urls.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/node_modules/c9/urls.js b/node_modules/c9/urls.js index 0284030c..f93d4468 100644 --- a/node_modules/c9/urls.js +++ b/node_modules/c9/urls.js @@ -73,6 +73,9 @@ function getBaseUrl(req, sourceBaseUrlPattern, targetBaseUrlPattern) { if (!sourceBaseUrlPattern) throw new Error("getBaseUrl() requires at least two arguments"); + + if (!targetBaseUrlPattern) + targetBaseUrlPattern = sourceBaseUrlPattern; var sourceHostMatcher = sourceBaseUrlPattern .replace(/^https?:\/\//, "") @@ -91,15 +94,10 @@ function getBaseUrl(req, sourceBaseUrlPattern, targetBaseUrlPattern) { targetHost = "c9.io"; } - if (/^(ide|vfs)./.test(targetHost) && !targetBaseUrlPattern) - console.error(new Error("Warning: no targetBaseUrlPattern specified, will stay at " + targetHost), { - sourceBaseUrlPattern: sourceBaseUrlPattern - }); - if (/^(ide|vfs)./.test(targetHost)) console.trace("Warning: possibly incorrect baseUrl constructed, with 'ide.' in the hostname: " + targetHost); - return replaceDomain(targetBaseUrlPattern || sourceBaseUrlPattern, targetHost) + return replaceDomain(targetBaseUrlPattern, targetHost) .replace(/\/$/, ""); } From 108781deda7cee93ec403e3184ee79763dd79e52 Mon Sep 17 00:00:00 2001 From: c9bot Date: Mon, 23 Nov 2015 18:03:56 +0100 Subject: [PATCH 29/57] c9-auto-bump 3.1.487 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 18688bd0..2d03596a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.486", + "version": "3.1.487", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From f75282e69ba3bbf480eab9bafdd87426039166cc Mon Sep 17 00:00:00 2001 From: c9bot Date: Mon, 23 Nov 2015 18:13:36 +0100 Subject: [PATCH 30/57] c9-auto-bump 3.1.488 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2d03596a..f5b5406d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.487", + "version": "3.1.488", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From c1fdf4906a5f4f7ff7151d10693450f7eaa4c5ae Mon Sep 17 00:00:00 2001 From: Lennart Kats Date: Mon, 23 Nov 2015 19:34:46 +0100 Subject: [PATCH 31/57] Revert "Refactor addtrait" --- node_modules/c9/has-internal-test-name.js | 22 ---------- .../c9/has-internal-test-name_test.js | 44 ------------------- node_modules/c9/skip-analytics.js | 5 +-- node_modules/c9/skip-analytics_test.js | 19 -------- 4 files changed, 1 insertion(+), 89 deletions(-) delete mode 100644 node_modules/c9/has-internal-test-name.js delete mode 100644 node_modules/c9/has-internal-test-name_test.js diff --git a/node_modules/c9/has-internal-test-name.js b/node_modules/c9/has-internal-test-name.js deleted file mode 100644 index 82f65452..00000000 --- a/node_modules/c9/has-internal-test-name.js +++ /dev/null @@ -1,22 +0,0 @@ -if (define === undefined) { - var define = function(fn) { - fn(require, exports, module); - }; -} - -define(function(require, exports, module) { - "use strict"; - - var internalTestNames = ["c9test", "c9 test"]; - var regex = new RegExp("^(" + internalTestNames.join("|") + ")+"); - - function hasInternalTestName(user) { - if (!user.name && !user.username) return false; - - var testedName = user.name ? user.name : user.username; - - return regex.test(testedName); - } - - module.exports = hasInternalTestName; -}); \ No newline at end of file diff --git a/node_modules/c9/has-internal-test-name_test.js b/node_modules/c9/has-internal-test-name_test.js deleted file mode 100644 index 9e5dff4c..00000000 --- a/node_modules/c9/has-internal-test-name_test.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; -"use mocha"; - -require("c9/inline-mocha")(module); -var assert = require("assert"); -var faker = require("faker"); -var hasInternalTestName= require("c9/has-internal-test-name"); - -describe("has-internal-test-name", function() { - - it("returns false when undefined name", function() { - var name; - - assert.equal(false, hasInternalTestName(name), "should return false when name undefined"); - }); - - it("returns true when name contains c9test", function() { - var name = "c9testregnjkdfkfd"; - assert.equal(true, hasInternalTestName(name), "should return true when name contains c9test"); - - name = "c9test01"; - assert.equal(true, hasInternalTestName(name), "should return true when name contains c9test"); - - name = "c9testjhrrj ffjh"; - assert.equal(true, hasInternalTestName(name), "should return true when name contains c9test"); - }); - - it("returns true when name contains c9 test", function() { - var name = "c9 test dkjfdgjhfgdfk"; - assert.equal(true, hasInternalTestName(name), "should return true when name contains c9 test"); - - name = "c9 test07"; - assert.equal(true, hasInternalTestName(name), "should return true when name contains c9 test"); - - name = "c9 testdkjfdgjhfgdfk"; - assert.equal(true, hasInternalTestName(name), "should return true when name contains c9 test"); - }); - - it("returns false when not internal user test name", function() { - var name = faker.name.firstName(); - - assert.equal(false, hasInternalTestName(name), "should return false when name is not for internal testing"); - }); -}); \ No newline at end of file diff --git a/node_modules/c9/skip-analytics.js b/node_modules/c9/skip-analytics.js index 9d6f4850..7362fd63 100644 --- a/node_modules/c9/skip-analytics.js +++ b/node_modules/c9/skip-analytics.js @@ -6,15 +6,12 @@ if (define === undefined) { define(function(require, exports, module) { "use strict"; - + var hasInternalDomain = require("c9/has-internal-domain"); - var hasInternalTestName = require("c9/has-internal-test-name"); function skipAnalytics(user) { if (!user) return true; if (user.id === -1) return true; - - if (hasInternalTestName(user)) return true; if (hasInternalDomain(user.email)) return true; return false; } diff --git a/node_modules/c9/skip-analytics_test.js b/node_modules/c9/skip-analytics_test.js index bfaf1215..300251b0 100644 --- a/node_modules/c9/skip-analytics_test.js +++ b/node_modules/c9/skip-analytics_test.js @@ -22,25 +22,6 @@ describe("skip-analytics", function() { assert.equal(true, skipAnalytics(user), "skipAnalytics should return true when user id is -1"); }); - - it("returns false when user does not have an internal test name and no email", function() { - var user = { - id: faker.random.uuid(), - name: faker.name.firstName() - }; - - assert.equal(false, skipAnalytics(user), "skipAnalytics should return false when user does not have an internal test name and no email"); - }); - - it("returns true when user has an internal test name and no email", function() { - var user = { - id: faker.random.uuid(), - name: "c9test07" - }; - - assert.equal(true, skipAnalytics(user), "skipAnalytics should return true when user has an internal test name and no email"); - }); - it("returns false when user has no email", function() { var user = { id: faker.random.uuid() From a40ad9fe173650b4bcf841d55a8528b6c1fa61cc Mon Sep 17 00:00:00 2001 From: Lennart Kats Date: Mon, 23 Nov 2015 19:35:15 +0100 Subject: [PATCH 32/57] Revert "Revert "Refactor addtrait"" --- node_modules/c9/has-internal-test-name.js | 22 ++++++++++ .../c9/has-internal-test-name_test.js | 44 +++++++++++++++++++ node_modules/c9/skip-analytics.js | 5 ++- node_modules/c9/skip-analytics_test.js | 19 ++++++++ 4 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 node_modules/c9/has-internal-test-name.js create mode 100644 node_modules/c9/has-internal-test-name_test.js diff --git a/node_modules/c9/has-internal-test-name.js b/node_modules/c9/has-internal-test-name.js new file mode 100644 index 00000000..82f65452 --- /dev/null +++ b/node_modules/c9/has-internal-test-name.js @@ -0,0 +1,22 @@ +if (define === undefined) { + var define = function(fn) { + fn(require, exports, module); + }; +} + +define(function(require, exports, module) { + "use strict"; + + var internalTestNames = ["c9test", "c9 test"]; + var regex = new RegExp("^(" + internalTestNames.join("|") + ")+"); + + function hasInternalTestName(user) { + if (!user.name && !user.username) return false; + + var testedName = user.name ? user.name : user.username; + + return regex.test(testedName); + } + + module.exports = hasInternalTestName; +}); \ No newline at end of file diff --git a/node_modules/c9/has-internal-test-name_test.js b/node_modules/c9/has-internal-test-name_test.js new file mode 100644 index 00000000..9e5dff4c --- /dev/null +++ b/node_modules/c9/has-internal-test-name_test.js @@ -0,0 +1,44 @@ +"use strict"; +"use mocha"; + +require("c9/inline-mocha")(module); +var assert = require("assert"); +var faker = require("faker"); +var hasInternalTestName= require("c9/has-internal-test-name"); + +describe("has-internal-test-name", function() { + + it("returns false when undefined name", function() { + var name; + + assert.equal(false, hasInternalTestName(name), "should return false when name undefined"); + }); + + it("returns true when name contains c9test", function() { + var name = "c9testregnjkdfkfd"; + assert.equal(true, hasInternalTestName(name), "should return true when name contains c9test"); + + name = "c9test01"; + assert.equal(true, hasInternalTestName(name), "should return true when name contains c9test"); + + name = "c9testjhrrj ffjh"; + assert.equal(true, hasInternalTestName(name), "should return true when name contains c9test"); + }); + + it("returns true when name contains c9 test", function() { + var name = "c9 test dkjfdgjhfgdfk"; + assert.equal(true, hasInternalTestName(name), "should return true when name contains c9 test"); + + name = "c9 test07"; + assert.equal(true, hasInternalTestName(name), "should return true when name contains c9 test"); + + name = "c9 testdkjfdgjhfgdfk"; + assert.equal(true, hasInternalTestName(name), "should return true when name contains c9 test"); + }); + + it("returns false when not internal user test name", function() { + var name = faker.name.firstName(); + + assert.equal(false, hasInternalTestName(name), "should return false when name is not for internal testing"); + }); +}); \ No newline at end of file diff --git a/node_modules/c9/skip-analytics.js b/node_modules/c9/skip-analytics.js index 7362fd63..9d6f4850 100644 --- a/node_modules/c9/skip-analytics.js +++ b/node_modules/c9/skip-analytics.js @@ -6,12 +6,15 @@ if (define === undefined) { define(function(require, exports, module) { "use strict"; - + var hasInternalDomain = require("c9/has-internal-domain"); + var hasInternalTestName = require("c9/has-internal-test-name"); function skipAnalytics(user) { if (!user) return true; if (user.id === -1) return true; + + if (hasInternalTestName(user)) return true; if (hasInternalDomain(user.email)) return true; return false; } diff --git a/node_modules/c9/skip-analytics_test.js b/node_modules/c9/skip-analytics_test.js index 300251b0..bfaf1215 100644 --- a/node_modules/c9/skip-analytics_test.js +++ b/node_modules/c9/skip-analytics_test.js @@ -22,6 +22,25 @@ describe("skip-analytics", function() { assert.equal(true, skipAnalytics(user), "skipAnalytics should return true when user id is -1"); }); + + it("returns false when user does not have an internal test name and no email", function() { + var user = { + id: faker.random.uuid(), + name: faker.name.firstName() + }; + + assert.equal(false, skipAnalytics(user), "skipAnalytics should return false when user does not have an internal test name and no email"); + }); + + it("returns true when user has an internal test name and no email", function() { + var user = { + id: faker.random.uuid(), + name: "c9test07" + }; + + assert.equal(true, skipAnalytics(user), "skipAnalytics should return true when user has an internal test name and no email"); + }); + it("returns false when user has no email", function() { var user = { id: faker.random.uuid() From d0b9b3df3b3c313ddf3ca8c27f25b06d4575d886 Mon Sep 17 00:00:00 2001 From: c9bot Date: Mon, 23 Nov 2015 19:35:38 +0100 Subject: [PATCH 33/57] c9-auto-bump 3.1.489 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f5b5406d..dacf3c1b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.488", + "version": "3.1.489", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From 48026f4b4b59e01f72f1b8695ef896cb696fa570 Mon Sep 17 00:00:00 2001 From: Dana Date: Mon, 23 Nov 2015 20:00:22 +0000 Subject: [PATCH 34/57] Fixes +10723 and adds extra tests --- node_modules/c9/skip-analytics.js | 2 +- node_modules/c9/skip-analytics_test.js | 40 +++++++++++++++----------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/node_modules/c9/skip-analytics.js b/node_modules/c9/skip-analytics.js index 9d6f4850..8c529009 100644 --- a/node_modules/c9/skip-analytics.js +++ b/node_modules/c9/skip-analytics.js @@ -12,7 +12,7 @@ define(function(require, exports, module) { function skipAnalytics(user) { if (!user) return true; - if (user.id === -1) return true; + if (user.id === -1 || user.uid === -1) return true; if (hasInternalTestName(user)) return true; if (hasInternalDomain(user.email)) return true; diff --git a/node_modules/c9/skip-analytics_test.js b/node_modules/c9/skip-analytics_test.js index bfaf1215..fe09f097 100644 --- a/node_modules/c9/skip-analytics_test.js +++ b/node_modules/c9/skip-analytics_test.js @@ -10,63 +10,71 @@ describe("skip-analytics", function() { it("returns true when user undefined", function() { var user; - + assert.equal(true, skipAnalytics(user), "skipAnalytics should return true when user undefined"); }); - + it("returns true when user id is -1", function() { var user = { id: -1 }; - + assert.equal(true, skipAnalytics(user), "skipAnalytics should return true when user id is -1"); }); - - + + it("returns true when user uid is -1", function() { + var user = { + uid: -1 + }; + + assert.equal(true, skipAnalytics(user), "skipAnalytics should return true when user uid is -1"); + }); + + it("returns false when user does not have an internal test name and no email", function() { var user = { id: faker.random.uuid(), name: faker.name.firstName() }; - + assert.equal(false, skipAnalytics(user), "skipAnalytics should return false when user does not have an internal test name and no email"); }); - + it("returns true when user has an internal test name and no email", function() { var user = { id: faker.random.uuid(), name: "c9test07" }; - + assert.equal(true, skipAnalytics(user), "skipAnalytics should return true when user has an internal test name and no email"); }); - + it("returns false when user has no email", function() { var user = { id: faker.random.uuid() }; - + assert.equal(false, skipAnalytics(user), "skipAnalytics should return false when user has no email"); }); - + it("returns true when user has internal email", function() { var user = { id: faker.random.uuid(), email: "test@c9.io" }; - + assert.equal(true, skipAnalytics(user), "skipAnalytics should return true when user has internal email"); - + user.email = "test@cloud9beta.com"; assert.equal(true, skipAnalytics(user), "skipAnalytics should return true when user has internal beta email"); }); - - it("returns false when user is authorized and does not have intermal email", function() { + + it("returns false when user is authorized and does not have intermal email", function() { var user = { id: faker.random.uuid(), email: faker.internet.email() }; - + assert.equal(false, skipAnalytics(user), "skipAnalytics should return false when user is authorized and does not have internal email"); }); }); \ No newline at end of file From 51f7bda3ec3800e9052e380544f713caa51e053e Mon Sep 17 00:00:00 2001 From: Matthijs van Henten Date: Mon, 23 Nov 2015 22:18:59 +0000 Subject: [PATCH 35/57] move available; expose available as part of user quota --- node_modules/c9/available.js | 31 ++++++++ node_modules/c9/available_test.js | 117 ++++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+) create mode 100644 node_modules/c9/available.js create mode 100644 node_modules/c9/available_test.js diff --git a/node_modules/c9/available.js b/node_modules/c9/available.js new file mode 100644 index 00000000..e4e8f60d --- /dev/null +++ b/node_modules/c9/available.js @@ -0,0 +1,31 @@ +"use strict"; + +var _ = require("lodash"); + +/** + * Substract all values of used from quota + extra + * This is the so-called "uncountedQuota" logic. + */ +function available(quota, used, extra) { + var keys = _.union(_.keys(quota), _.keys(used)); + + extra = extra || {}; + + return keys.reduce(function(available, key) { + available[key] = quota[key] || 0; + extra[key] = extra[key] || 0; + + if (!used[key]) + return available; + + var needed = used[key] - extra[key]; + + if (!needed) + return available; + + available[key] = available[key] - needed; + return available; + }, {}); +} + +module.exports = available; \ No newline at end of file diff --git a/node_modules/c9/available_test.js b/node_modules/c9/available_test.js new file mode 100644 index 00000000..512a4100 --- /dev/null +++ b/node_modules/c9/available_test.js @@ -0,0 +1,117 @@ +#!/usr/bin/env node + +"use strict"; +"use server"; + +require("c9/setup_paths"); +require("c9/inline-mocha")(module); + +var assert = require("assert-diff"); +var available = require("./available"); + +describe(__filename, function() { + it("Should do basic math for shared keys in the input", function() { + var cases = [{ + label: "When total < used", + total: { + ram: 10, + disk: 5, + }, + used: { + ram: 20, + disk: 5, + }, + avail: { + ram: -10, + disk: 0 + } + }, { + label: "When keys in total not in used", + total: { + ram: 10, + disk: 5, + foo: 10, + }, + used: { + ram: 10, + disk: 5, + }, + avail: { + ram: 0, + disk: 0, + foo: 10 + } + }, { + label: "When keys in used not in total", + total: { + ram: 10, + disk: 5, + }, + used: { + foo: 10, + ram: 10, + disk: 5, + }, + avail: { + ram: 0, + disk: 0, + foo: -10 + } + }, { + label: "When all looks normal", + total: { + ram: 10, + disk: 5, + }, + used: { + ram: 5, + disk: 2, + }, + avail: { + ram: 5, + disk: 3, + } + }, { + label: "With a little extra", + total: { + ram: 10, + disk: 6, + }, + used: { + ram: 10, + disk: 5, + }, + extra: { + ram: 3, + disk: 3 + }, + avail: { + ram: 3, + disk: 4, + } + }, { + label: "But extra is not more", + total: { + ram: 10, + disk: 10, + }, + used: { + ram: 5, + disk: 5, + }, + extra: { + ram: 5, + disk: 3 + }, + avail: { + ram: 10, + disk: 8, + } + }]; + + cases.forEach(function(testCase) { + var avail = available(testCase.total, testCase.used, testCase.extra); + assert.deepEqual(avail, testCase.avail, testCase.label); + }); + }); +}); \ No newline at end of file From 5475aa596200cc06595bc7178a3e42314eb40057 Mon Sep 17 00:00:00 2001 From: c9bot Date: Tue, 24 Nov 2015 09:15:55 +0100 Subject: [PATCH 36/57] c9-auto-bump 3.1.490 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dacf3c1b..e28392f5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.489", + "version": "3.1.490", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From f8b80313570dac3aa9abb8a9158a8c368bae3626 Mon Sep 17 00:00:00 2001 From: c9bot Date: Tue, 24 Nov 2015 09:17:08 +0100 Subject: [PATCH 37/57] c9-auto-bump 3.1.491 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e28392f5..edef9657 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.490", + "version": "3.1.491", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From 96c0bc133247933ba421846e853ca42d8a98180d Mon Sep 17 00:00:00 2001 From: c9bot Date: Tue, 24 Nov 2015 09:45:11 +0100 Subject: [PATCH 38/57] c9-auto-bump 3.1.492 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index edef9657..a4bc64ba 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.491", + "version": "3.1.492", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From cd56c2ff66819ca1942378ba0a8eb04e996b9d1f Mon Sep 17 00:00:00 2001 From: c9bot Date: Tue, 24 Nov 2015 10:02:39 +0100 Subject: [PATCH 39/57] c9-auto-bump 3.1.493 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a4bc64ba..4efb993e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.492", + "version": "3.1.493", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From 860a51b46ec664668475c26828ba690bd1e7a2fe Mon Sep 17 00:00:00 2001 From: c9bot Date: Tue, 24 Nov 2015 12:38:44 +0100 Subject: [PATCH 40/57] c9-auto-bump 3.1.494 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4efb993e..9285437b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.493", + "version": "3.1.494", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From 66ecc4b6ff37d0a2b1de4804121eb00275af3e5b Mon Sep 17 00:00:00 2001 From: c9bot Date: Tue, 24 Nov 2015 13:11:02 +0100 Subject: [PATCH 41/57] c9-auto-bump 3.1.495 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9285437b..ee423c68 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.494", + "version": "3.1.495", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From 251d8be2e5d9c8d56747fbcff6e005d730316020 Mon Sep 17 00:00:00 2001 From: c9bot Date: Tue, 24 Nov 2015 13:40:41 +0100 Subject: [PATCH 42/57] c9-auto-bump 3.1.496 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ee423c68..1a872c3a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.495", + "version": "3.1.496", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From 80ef16f94fa14255048918e441f1a3244ab92113 Mon Sep 17 00:00:00 2001 From: c9bot Date: Tue, 24 Nov 2015 14:40:17 +0100 Subject: [PATCH 43/57] c9-auto-bump 3.1.497 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1a872c3a..434bced0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.496", + "version": "3.1.497", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From 2f75c833a2699aeb00957551e880b694ed4145a7 Mon Sep 17 00:00:00 2001 From: c9bot Date: Tue, 24 Nov 2015 15:48:51 +0100 Subject: [PATCH 44/57] c9-auto-bump 3.1.498 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 434bced0..ba7fc5b0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.497", + "version": "3.1.498", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From e1df882fa2cbacf8c7d36075f74f0412c3f0726d Mon Sep 17 00:00:00 2001 From: c9bot Date: Tue, 24 Nov 2015 22:21:56 +0100 Subject: [PATCH 45/57] c9-auto-bump 3.1.499 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ba7fc5b0..a798b9b0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.498", + "version": "3.1.499", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From 006882f64f56aee8bc23e55300c379f90353cb2b Mon Sep 17 00:00:00 2001 From: c9bot Date: Tue, 24 Nov 2015 22:36:30 +0100 Subject: [PATCH 46/57] c9-auto-bump 3.1.500 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a798b9b0..b1c70a18 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.499", + "version": "3.1.500", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From b065bdb4799db857eb83a830956c7d48a148d5b5 Mon Sep 17 00:00:00 2001 From: c9bot Date: Tue, 24 Nov 2015 22:43:53 +0100 Subject: [PATCH 47/57] c9-auto-bump 3.1.501 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b1c70a18..5b8eb45a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.500", + "version": "3.1.501", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From be0eb157f35fc5b2c6a81f9ef985c6e9fd2c243a Mon Sep 17 00:00:00 2001 From: c9bot Date: Tue, 24 Nov 2015 22:59:29 +0100 Subject: [PATCH 48/57] c9-auto-bump 3.1.502 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5b8eb45a..2db22740 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.501", + "version": "3.1.502", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From 2deea872677bbdf17bc6edb7ea36a0f720de76fb Mon Sep 17 00:00:00 2001 From: c9bot Date: Tue, 24 Nov 2015 23:51:07 +0100 Subject: [PATCH 49/57] c9-auto-bump 3.1.503 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2db22740..09ac2ef5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.502", + "version": "3.1.503", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From ca939751bbc2baca8cf448724d5f742d7dbb2d56 Mon Sep 17 00:00:00 2001 From: c9bot Date: Wed, 25 Nov 2015 10:41:17 +0100 Subject: [PATCH 50/57] c9-auto-bump 3.1.504 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 09ac2ef5..d35f336c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.503", + "version": "3.1.504", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From 844091f2d9a69c5108ba38634266f6ae86debbca Mon Sep 17 00:00:00 2001 From: c9bot Date: Wed, 25 Nov 2015 10:42:20 +0100 Subject: [PATCH 51/57] c9-auto-bump 3.1.505 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d35f336c..409ab4cd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.504", + "version": "3.1.505", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From 8541a53200120f5353a2006cac7c18ed495e9d31 Mon Sep 17 00:00:00 2001 From: c9bot Date: Wed, 25 Nov 2015 10:48:36 +0100 Subject: [PATCH 52/57] c9-auto-bump 3.1.506 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 409ab4cd..3958a59a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.505", + "version": "3.1.506", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From 1fc689afba477a86b9662f67475343c02678e1a0 Mon Sep 17 00:00:00 2001 From: c9bot Date: Wed, 25 Nov 2015 10:50:13 +0100 Subject: [PATCH 53/57] c9-auto-bump 3.1.507 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3958a59a..f0510d4d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.506", + "version": "3.1.507", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From 47c9419cf770a5b391081987c9441f94ec5e93a3 Mon Sep 17 00:00:00 2001 From: c9bot Date: Wed, 25 Nov 2015 10:56:29 +0100 Subject: [PATCH 54/57] c9-auto-bump 3.1.508 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f0510d4d..0d03a227 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.507", + "version": "3.1.508", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From af83843de7a163a199319458d284adb976755052 Mon Sep 17 00:00:00 2001 From: c9bot Date: Wed, 25 Nov 2015 11:13:15 +0100 Subject: [PATCH 55/57] c9-auto-bump 3.1.509 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0d03a227..d837b694 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.508", + "version": "3.1.509", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From 2a6a81c1156a3b17b713341e62b8be6a9203e7e4 Mon Sep 17 00:00:00 2001 From: c9bot Date: Wed, 25 Nov 2015 12:59:17 +0100 Subject: [PATCH 56/57] c9-auto-bump 3.1.510 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d837b694..a28bc2af 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.509", + "version": "3.1.510", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", From c2ab338d29e591cf1123266a116191dc7c4e88ef Mon Sep 17 00:00:00 2001 From: c9bot Date: Wed, 25 Nov 2015 13:41:17 +0100 Subject: [PATCH 57/57] c9-auto-bump 3.1.511 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a28bc2af..9b14ce06 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.510", + "version": "3.1.511", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9",