Merge pull request +8583 from c9/fix-tests

fix test runner stopping on metrics test
pull/124/head
Nikolai Onken 2015-08-07 09:57:31 +02:00
commit c5048020f1
3 zmienionych plików z 29 dodań i 13 usunięć

Wyświetl plik

@ -134,7 +134,7 @@ var processLoadQueue = function(err, id) {
} }
}; };
define.amd = true; define.amd = {};
define.queue = []; define.queue = [];
define.loaded = {}; define.loaded = {};
define.errors = {}; define.errors = {};
@ -296,7 +296,7 @@ require.MODULE_LOAD_URL = MODULE_LOAD_URL;
require.toUrl = function(moduleName, ext, skipExt) { require.toUrl = function(moduleName, ext, skipExt) {
var absRe = /^([\w\+\.\-]+:|\/)/; var absRe = /^([\w\+\.\-]+:|\/)/;
var index = moduleName.indexOf("!"); var index = moduleName.indexOf("!");
if (index !== -1 || !ext) if (index !== -1 || !ext || /^\/|\.js$/.test(moduleName))
ext = ""; ext = "";
var paths = config.paths; var paths = config.paths;

Wyświetl plik

@ -105,9 +105,9 @@
"c9.ide.run": "#1e99c8c1d2", "c9.ide.run": "#1e99c8c1d2",
"c9.ide.run.build": "#ad45874c88", "c9.ide.run.build": "#ad45874c88",
"c9.ide.run.debug.xdebug": "#3b1520f83d", "c9.ide.run.debug.xdebug": "#3b1520f83d",
"c9.ide.save": "#58b8616a88", "c9.ide.save": "#cc613b6ead",
"c9.ide.scm": "#undefined", "c9.ide.scm": "#undefined",
"c9.ide.terminal.monitor": "#b0b4d03280", "c9.ide.terminal.monitor": "#b52a3f2144",
"c9.ide.theme.flat": "#2de8414db7", "c9.ide.theme.flat": "#2de8414db7",
"c9.ide.threewaymerge": "#229382aa0b", "c9.ide.threewaymerge": "#229382aa0b",
"c9.ide.undo": "#b028bcb4d5", "c9.ide.undo": "#b028bcb4d5",

Wyświetl plik

@ -16,7 +16,7 @@
<div id="mocha"></div> <div id="mocha"></div>
<div id='jserror' width='100%' height='20px' style='font: 10px \"courier new\"; color: red; display: none;'></div> <div id='jserror' width='100%' height='20px' style='font: 10px \"courier new\"; color: red; display: none;'></div>
<script src="require.js"></script> <script src="mini_require.js"></script>
<script src="/configs/require_config.js"></script> <script src="/configs/require_config.js"></script>
<script src="lib/mocha/mocha.js"></script> <script src="lib/mocha/mocha.js"></script>
<script> <script>
@ -156,7 +156,7 @@
require([path]); require([path]);
} }
// allow running some tests in both client and server // allow running some tests in both client and server
["amd-loader", "../../test/setup_paths"].forEach(defineEmpty); ["amd-loader", "test/setup_paths"].forEach(defineEmpty);
// require.config({paths: {chai: "lib/chai/chai"}}); // require.config({paths: {chai: "lib/chai/chai"}});
@ -173,7 +173,13 @@
}); });
var deps = ["text!/test/all.json", "lib/architect/architect", "lib/chai/chai", "test.js"]; var deps = [
"text!/test/all.json",
"lib/architect/architect",
"lib/chai/chai",
"test",
"plugins/c9.ide.ui/lib_less1.5"
];
if (options.ui === "none") if (options.ui === "none")
deps.shift(); deps.shift();
@ -226,8 +232,10 @@
running = false; running = false;
lastDone && lastDone(); lastDone && lastDone();
} }
running ? done() : mocha.run(done); if (!running) {
running = true; running = true;
mocha.run(done);
}
}; };
onload.remain = onload.remain == "1"; onload.remain = onload.remain == "1";
@ -347,14 +355,14 @@
} }
/* global requirejs require: true*/ /* global requirejs require: true*/
var defaultModules = Object.keys(requirejs.s.contexts._.defined).filter(function(x) { var defaultModules = Object.keys(define.modules).filter(function(x) {
return !/text!/.test(x); return !/text!/.test(x);
}); });
function cleanupRequireModules() { function cleanupRequireModules() {
Object.keys(require.s.contexts._.defined).forEach(function(x) { Object.keys(define.modules).forEach(function(x) {
if (/text!/.test(x) || defaultModules.indexOf(x) != -1) if (/text!/.test(x) || defaultModules.indexOf(x) != -1)
return; return;
if (/lib\/ace|lib\/treehugger|\/ctags\/ctags$/.test(x) && !/_test/.test(x)) if (/^ace|^treehugger|\/ctags\/ctags$/.test(x) && !/_test/.test(x))
return; return;
require.undef(x); require.undef(x);
@ -366,7 +374,15 @@
c = function(err) { c = function(err) {
lastDone && lastDone(err.message); lastDone && lastDone(err.message);
}; };
return requirejs(a, b, c); // workaround for sync minirequire behaviour
var bt = b && function() {
var args = [].slice.call(arguments);
var self = this;
setTimeout(function() {
b.apply(self, args);
});
};
return requirejs(a, bt, c);
}; };
Object.keys(requirejs).forEach(function(x) { Object.keys(requirejs).forEach(function(x) {
if (!(x in require)) { if (!(x in require)) {