runner.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. var config = {
  2. baseUrl: '../',
  3. paths: {
  4. "console-reporter": "tests/console-reporter",
  5. "es6-promise": "node_modules/es6-promise/dist/es6-promise.auto",
  6. "jquery": "node_modules/jquery/dist/jquery",
  7. "lodash": "node_modules/lodash/lodash",
  8. "lodash.converter": "3rdparty/lodash.fp",
  9. "lodash.fp": "src/lodash.fp",
  10. "lodash.noconflict": "node_modules/@converse/headless/lodash.noconflict",
  11. "pluggable": "node_modules/pluggable.js/dist/pluggable",
  12. "sizzle": "node_modules/sizzle/dist/sizzle",
  13. "underscore": "src/underscore-shim",
  14. },
  15. map: {
  16. // '*' means all modules will get the '*.noconflict' version
  17. // as their dependency.
  18. '*': {
  19. 'backbone': 'backbone.noconflict',
  20. 'lodash': 'lodash.noconflict'
  21. },
  22. // '*.noconflict' wants the real module
  23. // If this line was not here, there would
  24. // be an unresolvable cyclic dependency.
  25. 'backbone.noconflict': { 'backbone': 'backbone' },
  26. 'lodash.noconflict': { 'lodash': 'lodash' }
  27. },
  28. lodashLoader: {
  29. // Configuration for requirejs-tpl
  30. // Use Mustache style syntax for variable interpolation
  31. root: "src/templates/",
  32. templateSettings: {
  33. "escape": /\{\{\{([\s\S]+?)\}\}\}/g,
  34. "evaluate": /\{\[([\s\S]+?)\]\}/g,
  35. "interpolate": /\{\{([\s\S]+?)\}\}/g,
  36. // By default, template places the values from your data in the
  37. // local scope via the with statement. However, you can specify
  38. // a single variable name with the variable setting. This can
  39. // significantly improve the speed at which a template is able
  40. // to render.
  41. "variable": 'o'
  42. }
  43. },
  44. // define module dependencies for modules not using define
  45. shim: {
  46. 'backbone.orderedlistview': { deps: ['backbone.nativeview'] },
  47. 'backbone.overview': { deps: ['backbone.nativeview'] },
  48. 'backbone.vdomview': { deps: ['backbone.nativeview'] },
  49. 'emojione': { exports: 'emojione'},
  50. 'xss': {
  51. 'init': function (xss_noconflict) {
  52. return {
  53. filterXSS: window.filterXSS,
  54. filterCSS: window.filterCSS
  55. }
  56. }
  57. }
  58. }
  59. };
  60. // Extra test dependencies
  61. config.paths.mock = "tests/mock";
  62. config.paths['wait-until-promise'] = "node_modules/wait-until-promise/index";
  63. config.paths['test-utils'] = "tests/utils";
  64. config.paths.sinon = "node_modules/sinon/pkg/sinon";
  65. config.paths.transcripts = "converse-logs/converse-logs";
  66. config.paths["jasmine-core"] = "node_modules/jasmine-core/lib/jasmine-core/jasmine";
  67. config.paths.jasmine = "node_modules/jasmine-core/lib/jasmine-core/boot";
  68. config.paths["jasmine-console"] = "node_modules/jasmine-core/lib/console/console";
  69. config.paths["jasmine-html"] = "node_modules/jasmine-core/lib/jasmine-core/jasmine-html";
  70. config.shim.jasmine = {
  71. exports: 'window.jasmineRequire'
  72. };
  73. config.shim['jasmine-html'] = {
  74. deps: ['jasmine-core'],
  75. exports: 'window.jasmineRequire'
  76. };
  77. config.shim['jasmine-console'] = {
  78. deps: ['jasmine-core'],
  79. exports: 'window.jasmineRequire'
  80. };
  81. config.shim.jasmine = {
  82. deps: ['jasmine-core', 'jasmine-html', 'jasmine-console'],
  83. exports: 'window.jasmine'
  84. };
  85. require.config(config);
  86. var specs = [
  87. "jasmine",
  88. //"spec/transcripts",
  89. "spec/spoilers",
  90. "spec/profiling",
  91. "spec/utils",
  92. "spec/converse",
  93. "spec/bookmarks",
  94. "spec/roomslist",
  95. "spec/headline",
  96. "spec/disco",
  97. "spec/protocol",
  98. "spec/presence",
  99. "spec/eventemitter",
  100. "spec/ping",
  101. "spec/push",
  102. "spec/xmppstatus",
  103. "spec/mam",
  104. "spec/omemo",
  105. "spec/controlbox",
  106. "spec/roster",
  107. "spec/chatbox",
  108. "spec/user-details-modal",
  109. "spec/messages",
  110. "spec/muc",
  111. "spec/room_registration",
  112. "spec/autocomplete",
  113. "spec/minchats",
  114. "spec/notification",
  115. "spec/login",
  116. "spec/register",
  117. "spec/http-file-upload"
  118. ];
  119. require(['console-reporter', 'mock', 'sinon', 'wait-until-promise', 'pluggable'],
  120. function(ConsoleReporter, mock, sinon, waitUntilPromise, pluggable) {
  121. if (window.view_mode) {
  122. mock.view_mode = window.view_mode;
  123. }
  124. window.sinon = sinon;
  125. window.waitUntilPromise = waitUntilPromise.default;
  126. window.localStorage.clear();
  127. window.sessionStorage.clear();
  128. // Load the specs
  129. require(specs, function (jasmine) {
  130. var jasmineEnv = jasmine.getEnv();
  131. jasmineEnv.addReporter(new ConsoleReporter());
  132. window.onload();
  133. });
  134. });