forked from LivelyKernel/LivelyKernel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_tests.js
228 lines (193 loc) · 6.83 KB
/
run_tests.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
/*global alertOK, require, TestSuite, unescape, $, JSON*/
// some helpers
function exit() {
window.open('', '_self', '');
window.close();
}
function prepareConfig() {
lively.Config.set("computeCodeEditorCompletionsOnStartup", false);
// For closing the browser
lively.Config.set("askBeforeQuit", false);
// for network tests
lively.Config.set("serverInvokedTest", true);
}
function alertForever(msg) {
alert(msg, 99999);
}
function getURLParam(name) {
if (Global.testRun && testRun.hasOwnProperty(name)) {
return testRun[name];
}
var queryRegex = new RegExp(name + '=([^\\&]+)'),
match = document.URL.split('?').last().match(queryRegex),
// FIXME OMeta overwrite unescape
unescape = window._unescape || window.unescape;
return match && unescape(match[1]);
}
function serverLog(msg) {
lively.Server && lively.Server.log(msg, {sync: true});
}
// some preparation
var testRunId = getURLParam("testRunId");
if (!testRunId) {
var msg = 'no id for test run, cannot execute tests';
alertForever(msg);
throw msg;
}
// result processing
function postResult(message) {
alertOK("Result: \n" + message);
$.post('/test-result/' + testRunId, {testRunId: testRunId, testResults: message});
}
// running the actual tests
var baseTests = [
// core
"lively.tests.BaseTests",
"lively.tests.ClassTests",
"lively.tests.ModuleSystemTests",
"lively.tests.NetworkTests",
"lively.tests.ObjectTests",
"lively.tests.PartsTestFrameworkTests",
"lively.tests.TestFrameworkTests",
"lively.tests.TracingTests",
"lively.tests.TraitTests",
// AST / OMeta
"ometa.tests.OmetaTests",
"lively.ast.tests.AcornTests",
// persistence
"lively.persistence.tests.BuildSpec",
"lively.persistence.tests.PersistenceTests",
"lively.persistence.tests.TraitPersistenceTests",
//bindings
"lively.bindings.tests.BindingTests"
];
var browserTests = [
// core
"lively.tests.BootstrapTests",
"lively.tests.CoreTests",
"lively.tests.HelperTests",
// network
"lively.net.tests.SessionTracker",
"lively.net.tests.Wiki",
// lang support
"lively.lang.tests.ExtensionTests",
"lively.lang.tests.VM",
// 2014-11-01 rk: the worker interface has changed since switching to
// lively.lang, so these tests are more or less not needed anymore. I wanna
// check them for useful stuff before removing them, however.
// "lively.lang.tests.WorkerTests",
// persistence
"lively.persistence.tests.MassMorphCreation",
'lively.persistence.tests.MorphicState',
'lively.persistence.tests.MorphicProperties',
// presentation
"lively.presentation.tests.Builds",
// data import/export
"lively.data.tests.ODFImport",
//bindings
"lively.bindings.tests.FRPCoreTests",
"lively.bindings.tests.FRPSerialization",
"lively.bindings.tests.GeometryBindingTests",
// serialization / storage
"lively.persistence.tests.MassMorphCreation",
"lively.persistence.tests.TraitPersistenceTests",
"lively.store.tests.Interface",
// ide / SCB
"lively.ide.tests.ASTEditingSupport",
'lively.ide.tests.BrowserAddonTests',
"lively.ide.tests.CodeEditor",
// rk 2015-09-02: travis seems to have issues with maintining the l2l
// connection needed for the shell tests and the shell environment itself
// 'lively.ide.tests.CommandLineInterface',
"lively.ide.codeeditor.tests.JumpChar",
"lively.ide.codeeditor.tests.DraggableCode",
"lively.ide.codeeditor.tests.MorphicOverlays",
"lively.ide.codeeditor.tests.TextOverlays",
'lively.ide.codeeditor.tests.DiffMode',
'lively.ide.codeeditor.tests.TreeMode',
'lively.ide.git.tests.Interface',
"lively.ide.tests.FileParserTests",
"lively.ide.tests.FileSystem",
"lively.ide.tests.ModuleLookup",
"lively.ide.tests.SCBTests",
"lively.ide.tests.SyntaxHighlighting",
"lively.ide.tests.WindowNavigation",
"lively.ide.tools.tests.CommandLine",
// PartsBin
"lively.tests.PartsBinTests",
// morphic
"lively.morphic.tests.Canvas",
"lively.morphic.tests.Connectors",
"lively.morphic.tests.CoreToolsTests",
"lively.morphic.tests.DataGridTests",
"lively.morphic.tests.DraggableJavaScript",
"lively.morphic.tests.DiffMerge",
"lively.morphic.tests.EventTests",
"lively.morphic.tests.Graphics",
"lively.morphic.tests.HTML",
"lively.morphic.tests.HTMLText",
"lively.morphic.tests.Layout",
"lively.morphic.tests.Lists",
"lively.morphic.tests.Morphic",
"lively.morphic.tests.Morphic2",
"lively.morphic.tests.MorphAddons",
"lively.morphic.tests.PathTests",
"lively.morphic.tests.Scrubbing",
"lively.morphic.tests.Serialization",
"lively.morphic.tests.ShapeTests",
"lively.morphic.tests.StyleSheets",
"lively.morphic.tests.StyleSheetsHTML",
"lively.morphic.tests.TabTests",
"lively.morphic.tests.Text",
"lively.morphic.tests.TextUndoTests",
"lively.morphic.tests.Tree",
"lively.users.tests.Tests",
// cop
"cop.tests.LayerTests"
];
var testList = baseTests;
if (!Global.testRun || !testRun.isNodeJS) {
testList.pushAll(browserTests);
}
var additionalModules = getURLParam('additionalModules');
if (additionalModules) {
var moduleNames = additionalModules.split(',');
testList.pushAll(moduleNames);
}
// filter is something like "lively.morphic.*|.*Origin.*|test03"
var filter = getURLParam('testFilter'), suiteFilter;
if (filter) {
var parts = filter.split('|'),
modulePart = parts[0],
moduleFilterRegexp = new RegExp(modulePart, "i");
testList = testList.select(function(name) {
return moduleFilterRegexp.test(name) });
suiteFilter = parts.slice(1).join('|'); // last 2
}
prepareConfig();
(function setUserName() {
lively.morphic.World.current().setCurrentUser("run_tests-" + testRunId);
})();
if (lively.Config.get("serverTestDebug")) {
// So we can connect to the test server via l2l
function sendLogMessage() {
lively.Server && lively.Server.logThrottled('debugging the tests in progress');
}
Global.travisDebugLogInterval = setInterval(sendLogMessage, 30*1000);
} else {
require(['lively.TestFramework', 'lively.Server'].concat(testList)).toRun(function() {
serverLog("Automatic test process will run " + testList.length + " tests.");
lively.Server.enableSendingConsoleLogsToServer({timeout: 1500});
var suite = TestSuite.forAllAvailableTests(suiteFilter);
suite.runFinished = function() {
if (Global.testRun) {
testRun.onTestResult(suite.result.asJSON());
} else {
var result = suite.result.asJSONString();
postResult(result);
if (!getURLParam('stayOpen')) { exit.delay(0.5); }
}
};
suite.runAll();
});
}