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.

getResultHeader.js 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 _terminalLink() {
  14. const data = _interopRequireDefault(require('terminal-link'));
  15. _terminalLink = function () {
  16. return data;
  17. };
  18. return data;
  19. }
  20. function _jestUtil() {
  21. const data = require('jest-util');
  22. _jestUtil = function () {
  23. return data;
  24. };
  25. return data;
  26. }
  27. var _utils = require('./utils');
  28. function _interopRequireDefault(obj) {
  29. return obj && obj.__esModule ? obj : {default: obj};
  30. }
  31. /**
  32. * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  33. *
  34. * This source code is licensed under the MIT license found in the
  35. * LICENSE file in the root directory of this source tree.
  36. */
  37. const LONG_TEST_COLOR = _chalk().default.reset.bold.bgRed; // Explicitly reset for these messages since they can get written out in the
  38. // middle of error logging
  39. const FAIL_TEXT = 'FAIL';
  40. const PASS_TEXT = 'PASS';
  41. const FAIL = _chalk().default.supportsColor
  42. ? _chalk().default.reset.inverse.bold.red(` ${FAIL_TEXT} `)
  43. : FAIL_TEXT;
  44. const PASS = _chalk().default.supportsColor
  45. ? _chalk().default.reset.inverse.bold.green(` ${PASS_TEXT} `)
  46. : PASS_TEXT;
  47. var _default = (result, globalConfig, projectConfig) => {
  48. var _result$perfStats;
  49. const testPath = result.testFilePath;
  50. const formattedTestPath = (0, _utils.formatTestPath)(
  51. projectConfig ? projectConfig : globalConfig,
  52. testPath
  53. );
  54. const fileLink = (0, _terminalLink().default)(
  55. formattedTestPath,
  56. `file://${testPath}`,
  57. {
  58. fallback: () => formattedTestPath
  59. }
  60. );
  61. const status =
  62. result.numFailingTests > 0 || result.testExecError ? FAIL : PASS;
  63. const testDetail = [];
  64. if (
  65. (_result$perfStats = result.perfStats) !== null &&
  66. _result$perfStats !== void 0 &&
  67. _result$perfStats.slow
  68. ) {
  69. const runTime = result.perfStats.runtime / 1000;
  70. testDetail.push(LONG_TEST_COLOR((0, _jestUtil().formatTime)(runTime, 0)));
  71. }
  72. if (result.memoryUsage) {
  73. const toMB = bytes => Math.floor(bytes / 1024 / 1024);
  74. testDetail.push(`${toMB(result.memoryUsage)} MB heap size`);
  75. }
  76. const projectDisplayName =
  77. projectConfig && projectConfig.displayName
  78. ? (0, _utils.printDisplayName)(projectConfig) + ' '
  79. : '';
  80. return (
  81. `${status} ${projectDisplayName}${fileLink}` +
  82. (testDetail.length ? ` (${testDetail.join(', ')})` : '')
  83. );
  84. };
  85. exports.default = _default;