2
0

main.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // Extra test dependencies
  2. config.paths.mock = "tests/mock";
  3. config.paths.test_utils = "tests/utils";
  4. config.paths.sinon = "node_modules/sinon/lib/sinon";
  5. config.paths.jasmine = "node_modules/jasmine-core/lib/jasmine-core/jasmine";
  6. config.paths.transcripts = "converse-logs/converse-logs";
  7. config.paths["jasmine-html"] = "node_modules/jasmine-core/lib/jasmine-core/jasmine-html";
  8. config.paths["console-runner"] = "node_modules/phantom-jasmine/lib/console-runner";
  9. config.shim['jasmine-html'] = {
  10. deps: ['jasmine'],
  11. exports: 'jasmine'
  12. };
  13. config.shim['console-runner'] = {
  14. deps: ['jasmine']
  15. };
  16. require.config(config);
  17. // Polyfill 'bind' which is not available in phantomjs < 2.0
  18. if (!Function.prototype.bind) {
  19. Function.prototype.bind = function (oThis) {
  20. if (typeof this !== "function") {
  21. // closest thing possible to the ECMAScript 5 internal IsCallable function
  22. throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
  23. }
  24. var aArgs = Array.prototype.slice.call(arguments, 1),
  25. fToBind = this,
  26. fNOP = function () {},
  27. fBound = function () {
  28. return fToBind.apply(this instanceof fNOP && oThis ? this : oThis,
  29. aArgs.concat(Array.prototype.slice.call(arguments)));
  30. };
  31. fNOP.prototype = this.prototype;
  32. fBound.prototype = new fNOP();
  33. return fBound;
  34. };
  35. }
  36. require([
  37. "jquery",
  38. "mock",
  39. "jasmine-html",
  40. "sinon",
  41. "console-runner",
  42. //"spec/transcripts",
  43. "spec/utils",
  44. "spec/converse",
  45. "spec/bookmarks",
  46. "spec/headline",
  47. "spec/disco",
  48. "spec/protocol",
  49. "spec/presence",
  50. "spec/mam",
  51. "spec/otr",
  52. "spec/eventemitter",
  53. "spec/controlbox",
  54. "spec/chatbox",
  55. "spec/chatroom",
  56. "spec/minchats",
  57. "spec/notification",
  58. "spec/profiling",
  59. "spec/ping",
  60. "spec/register",
  61. "spec/xmppstatus"
  62. ], function($, mock, jasmine, sinon) {
  63. window.sinon = sinon;
  64. window.localStorage.clear();
  65. window.sessionStorage.clear();
  66. // Jasmine stuff
  67. var jasmineEnv = jasmine.getEnv();
  68. var reporter;
  69. if (/PhantomJS/.test(navigator.userAgent)) {
  70. reporter = new jasmine.ConsoleReporter();
  71. window.console_reporter = reporter;
  72. jasmineEnv.addReporter(reporter);
  73. jasmineEnv.updateInterval = 0;
  74. } else {
  75. reporter = new jasmine.HtmlReporter();
  76. jasmineEnv.addReporter(reporter);
  77. jasmineEnv.specFilter = function(spec) {
  78. return reporter.specFilter(spec);
  79. };
  80. jasmineEnv.updateInterval = 0;
  81. }
  82. jasmineEnv.execute();
  83. }
  84. );