all.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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.window = {
  24. location: {},
  25. navigator: tmp.window.navigator,
  26. document: {
  27. body: tmp.window.document.body,
  28. addEventListener: (...args) => tmp.window.document.addEventListener(...args)
  29. },
  30. matchMedia: function () {
  31. return {
  32. matches: false,
  33. addEventListener: function () {}
  34. };
  35. }
  36. };
  37. requirejs(
  38. ['test/unit/setup'],
  39. function () {
  40. glob(
  41. 'out/languages/amd-tsc/basic-languages/*/*.test.js',
  42. { cwd: path.join(__dirname, '../../') },
  43. function (err, files) {
  44. if (err) {
  45. console.log(err);
  46. return;
  47. }
  48. requirejs(
  49. files.map((f) => f.replace(/^out\/languages\/amd-tsc/, 'vs').replace(/\.js$/, '')),
  50. function () {
  51. run(); // We can launch the tests!
  52. },
  53. function (err) {
  54. console.log(err);
  55. }
  56. );
  57. }
  58. );
  59. },
  60. function (err) {
  61. console.log(err);
  62. process.exit(1);
  63. }
  64. );