all.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. const requirejs = require('requirejs');
  2. const jsdom = require('jsdom');
  3. const glob = require('glob');
  4. const path = require('path');
  5. requirejs.config({
  6. baseUrl: '',
  7. paths: {
  8. 'vs/fillers/monaco-editor-core': 'out/languages/amd-tsc/fillers/monaco-editor-core-amd',
  9. 'vs/basic-languages': 'out/languages/amd-tsc/basic-languages',
  10. vs: './node_modules/monaco-editor-core/dev/vs'
  11. },
  12. nodeRequire: require
  13. });
  14. const tmp = new jsdom.JSDOM('<!DOCTYPE html><html><body></body></html>');
  15. global.AMD = true;
  16. global.document = tmp.window.document;
  17. global.navigator = tmp.window.navigator;
  18. global.self = global;
  19. global.document.queryCommandSupported = function () {
  20. return false;
  21. };
  22. global.UIEvent = tmp.window.UIEvent;
  23. global._VSCODE_FILE_ROOT = '';
  24. global.window = {
  25. location: {},
  26. navigator: tmp.window.navigator,
  27. document: {
  28. body: tmp.window.document.body,
  29. addEventListener: (...args) => tmp.window.document.addEventListener(...args)
  30. },
  31. matchMedia: function () {
  32. return {
  33. matches: false,
  34. addEventListener: function () {}
  35. };
  36. },
  37. setInterval: function () {},
  38. setTimeout: function () {}
  39. };
  40. requirejs(
  41. ['test/unit/setup'],
  42. function () {
  43. glob(
  44. 'out/languages/amd-tsc/basic-languages/*/*.test.js',
  45. { cwd: path.join(__dirname, '../../') },
  46. function (err, files) {
  47. if (err) {
  48. console.log(err);
  49. return;
  50. }
  51. requirejs(
  52. files.map((f) => f.replace(/^out\/languages\/amd-tsc/, 'vs').replace(/\.js$/, '')),
  53. function () {
  54. run(); // We can launch the tests!
  55. },
  56. function (err) {
  57. console.log(err);
  58. }
  59. );
  60. }
  61. );
  62. },
  63. function (err) {
  64. console.log(err);
  65. process.exit(1);
  66. }
  67. );