Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/test/monaco/runner.js
3520 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
const yaserver = require('yaserver');
7
const http = require('http');
8
const cp = require('child_process');
9
10
const PORT = 8563;
11
12
yaserver.createServer({
13
rootDir: __dirname
14
}).then((staticServer) => {
15
const server = http.createServer((request, response) => {
16
return staticServer.handle(request, response);
17
});
18
server.listen(PORT, '127.0.0.1', () => {
19
runTests().then(() => {
20
console.log(`All good`);
21
process.exit(0);
22
}, (err) => {
23
console.error(err);
24
process.exit(1);
25
});
26
});
27
});
28
29
function runTests() {
30
return (
31
runTest('chromium')
32
.then(() => runTest('firefox'))
33
// .then(() => runTest('webkit'))
34
);
35
}
36
37
function runTest(browser) {
38
return new Promise((resolve, reject) => {
39
const proc = cp.spawn('node', ['../../node_modules/mocha/bin/mocha', 'out/*.test.js', '--headless'], {
40
env: { BROWSER: browser, ...process.env },
41
stdio: 'inherit'
42
});
43
proc.on('error', reject);
44
proc.on('exit', (code) => {
45
if (code === 0) {
46
resolve();
47
} else {
48
reject(code);
49
}
50
});
51
});
52
}
53
54