Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

getConsoleOutput.js 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. function _chalk() {
  7. const data = _interopRequireDefault(require('chalk'));
  8. _chalk = function () {
  9. return data;
  10. };
  11. return data;
  12. }
  13. function _jestMessageUtil() {
  14. const data = require('jest-message-util');
  15. _jestMessageUtil = function () {
  16. return data;
  17. };
  18. return data;
  19. }
  20. function _interopRequireDefault(obj) {
  21. return obj && obj.__esModule ? obj : {default: obj};
  22. }
  23. /**
  24. * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  25. *
  26. * This source code is licensed under the MIT license found in the
  27. * LICENSE file in the root directory of this source tree.
  28. */
  29. var _default = (buffer, config, globalConfig) => {
  30. const TITLE_INDENT = globalConfig.verbose ? ' ' : ' ';
  31. const CONSOLE_INDENT = TITLE_INDENT + ' ';
  32. const logEntries = buffer.reduce((output, {type, message, origin}) => {
  33. message = message
  34. .split(/\n/)
  35. .map(line => CONSOLE_INDENT + line)
  36. .join('\n');
  37. let typeMessage = 'console.' + type;
  38. let noStackTrace = true;
  39. let noCodeFrame = true;
  40. if (type === 'warn') {
  41. var _globalConfig$noStack;
  42. message = _chalk().default.yellow(message);
  43. typeMessage = _chalk().default.yellow(typeMessage);
  44. noStackTrace =
  45. (_globalConfig$noStack =
  46. globalConfig === null || globalConfig === void 0
  47. ? void 0
  48. : globalConfig.noStackTrace) !== null &&
  49. _globalConfig$noStack !== void 0
  50. ? _globalConfig$noStack
  51. : false;
  52. noCodeFrame = false;
  53. } else if (type === 'error') {
  54. var _globalConfig$noStack2;
  55. message = _chalk().default.red(message);
  56. typeMessage = _chalk().default.red(typeMessage);
  57. noStackTrace =
  58. (_globalConfig$noStack2 =
  59. globalConfig === null || globalConfig === void 0
  60. ? void 0
  61. : globalConfig.noStackTrace) !== null &&
  62. _globalConfig$noStack2 !== void 0
  63. ? _globalConfig$noStack2
  64. : false;
  65. noCodeFrame = false;
  66. }
  67. const options = {
  68. noCodeFrame,
  69. noStackTrace
  70. };
  71. const formattedStackTrace = (0, _jestMessageUtil().formatStackTrace)(
  72. origin,
  73. config,
  74. options
  75. );
  76. return (
  77. output +
  78. TITLE_INDENT +
  79. _chalk().default.dim(typeMessage) +
  80. '\n' +
  81. message.trimRight() +
  82. '\n' +
  83. _chalk().default.dim(formattedStackTrace.trimRight()) +
  84. '\n\n'
  85. );
  86. }, '');
  87. return logEntries.trimRight() + '\n';
  88. };
  89. exports.default = _default;