configuration-parser.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var ConfigurationParser = (function () {
  4. function ConfigurationParser() {
  5. }
  6. ConfigurationParser.parse = function (conf) {
  7. return ConfigurationParser.merge(ConfigurationParser.defaultConfiguration, conf);
  8. };
  9. ConfigurationParser.merge = function (template, override) {
  10. var result = {};
  11. for (var key in template) {
  12. if (template[key] instanceof Object
  13. && !(template[key] instanceof Array)
  14. && !(template[key] instanceof Function)
  15. && override instanceof Object
  16. && override[key] instanceof Object
  17. && !(override[key] instanceof Array)
  18. && !(override[key] instanceof Function)) {
  19. result[key] = ConfigurationParser.merge(template[key], override[key]);
  20. }
  21. else if (override instanceof Object
  22. && Object.keys(override).indexOf(key) !== -1) {
  23. result[key] = override[key];
  24. }
  25. else {
  26. result[key] = template[key];
  27. }
  28. }
  29. if (override instanceof Object && override.customOptions) {
  30. result.customOptions = override.customOptions;
  31. }
  32. return result;
  33. };
  34. ConfigurationParser.isWindows = process && process.platform === "win32";
  35. ConfigurationParser.defaultConfiguration = {
  36. colors: {
  37. enabled: true,
  38. failed: "red",
  39. pending: "yellow",
  40. successful: "green",
  41. },
  42. customProcessors: [],
  43. prefixes: {
  44. failed: ConfigurationParser.isWindows ? "\u00D7 " : "✗ ",
  45. pending: "* ",
  46. successful: ConfigurationParser.isWindows ? "\u221A " : "✓ ",
  47. },
  48. print: function (stuff) { return console.log(stuff); },
  49. spec: {
  50. displayDuration: false,
  51. displayErrorMessages: true,
  52. displayFailed: true,
  53. displayPending: false,
  54. displayStacktrace: false,
  55. displaySuccessful: true,
  56. },
  57. stacktrace: {
  58. filter: function (stacktrace) {
  59. var lines = stacktrace.split("\n");
  60. var filtered = [];
  61. for (var i = 1; i < lines.length; i++) {
  62. if (!/(jasmine[^\/]*\.js|Timer\.listOnTimeout)/.test(lines[i])) {
  63. filtered.push(lines[i]);
  64. }
  65. }
  66. return filtered.join("\n");
  67. }
  68. },
  69. suite: {
  70. displayNumber: false,
  71. },
  72. summary: {
  73. displayDuration: true,
  74. displayErrorMessages: true,
  75. displayFailed: true,
  76. displayPending: true,
  77. displayStacktrace: false,
  78. displaySuccessful: false,
  79. },
  80. };
  81. return ConfigurationParser;
  82. }());
  83. exports.ConfigurationParser = ConfigurationParser;
  84. //# sourceMappingURL=configuration-parser.js.map