2020-09-02 23:44:31 +08:00
|
|
|
const requirejs = require('requirejs');
|
|
|
|
const jsdom = require('jsdom');
|
|
|
|
const glob = require('glob');
|
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
requirejs.config({
|
2021-11-12 22:27:47 +08:00
|
|
|
baseUrl: 'monaco-languages',
|
2020-09-02 23:44:31 +08:00
|
|
|
paths: {
|
|
|
|
'vs/css': 'test/css.mock',
|
|
|
|
'vs/nls': 'test/nls.mock',
|
2021-11-12 22:27:47 +08:00
|
|
|
'vs/basic-languages/fillers/monaco-editor-core': 'out/amd/fillers/monaco-editor-core-amd',
|
|
|
|
'vs/basic-languages': 'out/amd',
|
|
|
|
vs: '../node_modules/monaco-editor-core/dev/vs'
|
2020-09-02 23:44:31 +08:00
|
|
|
},
|
|
|
|
nodeRequire: require
|
|
|
|
});
|
|
|
|
|
|
|
|
const tmp = new jsdom.JSDOM('<!DOCTYPE html><html><body></body></html>');
|
2021-11-12 22:27:47 +08:00
|
|
|
global.AMD = true;
|
2020-09-02 23:44:31 +08:00
|
|
|
global.document = tmp.window.document;
|
|
|
|
global.navigator = tmp.window.navigator;
|
|
|
|
global.self = global;
|
|
|
|
global.document.queryCommandSupported = function () {
|
|
|
|
return false;
|
|
|
|
};
|
2021-05-12 23:46:52 +08:00
|
|
|
global.window = {
|
|
|
|
location: {},
|
|
|
|
navigator: tmp.window.navigator,
|
|
|
|
matchMedia: function () {
|
|
|
|
return {
|
|
|
|
matches: false,
|
|
|
|
addListener: function () {}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
2020-09-02 23:44:31 +08:00
|
|
|
|
|
|
|
requirejs(
|
2021-11-12 22:27:47 +08:00
|
|
|
['test/setup'],
|
2020-09-02 23:44:31 +08:00
|
|
|
function () {
|
2020-09-19 07:28:33 +08:00
|
|
|
glob('out/amd/*/*.test.js', { cwd: path.dirname(__dirname) }, function (err, files) {
|
2020-09-08 19:40:42 +08:00
|
|
|
if (err) {
|
|
|
|
console.log(err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
requirejs(
|
2021-11-12 22:27:47 +08:00
|
|
|
files.map((f) => f.replace(/^out\/amd/, 'vs/basic-languages').replace(/\.js$/, '')),
|
2020-09-08 19:40:42 +08:00
|
|
|
function () {
|
|
|
|
// We can launch the tests!
|
|
|
|
},
|
|
|
|
function (err) {
|
2020-09-02 23:44:31 +08:00
|
|
|
console.log(err);
|
|
|
|
}
|
2020-09-08 19:40:42 +08:00
|
|
|
);
|
|
|
|
});
|
2020-09-02 23:44:31 +08:00
|
|
|
},
|
|
|
|
function (err) {
|
|
|
|
console.log(err);
|
|
|
|
}
|
|
|
|
);
|