monaco-editor/test/unit/all.js

62 lines
1.3 KiB
JavaScript

const requirejs = require('requirejs');
const jsdom = require('jsdom');
const glob = require('glob');
const path = require('path');
requirejs.config({
baseUrl: '',
paths: {
'vs/fillers/monaco-editor-core': 'out/amd/fillers/monaco-editor-core-amd',
'vs/basic-languages': 'out/amd/basic-languages',
vs: './node_modules/monaco-editor-core/dev/vs'
},
nodeRequire: require
});
const tmp = new jsdom.JSDOM('<!DOCTYPE html><html><body></body></html>');
global.AMD = true;
global.document = tmp.window.document;
global.navigator = tmp.window.navigator;
global.self = global;
global.document.queryCommandSupported = function () {
return false;
};
global.window = {
location: {},
navigator: tmp.window.navigator,
matchMedia: function () {
return {
matches: false,
addListener: function () {}
};
}
};
requirejs(
['test/unit/setup'],
function () {
glob(
'out/amd/basic-languages/*/*.test.js',
{ cwd: path.join(__dirname, '../../') },
function (err, files) {
if (err) {
console.log(err);
return;
}
requirejs(
files.map((f) => f.replace(/^out\/amd/, 'vs').replace(/\.js$/, '')),
function () {
run(); // We can launch the tests!
},
function (err) {
console.log(err);
}
);
}
);
},
function (err) {
console.log(err);
}
);