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.

getSnapshotSummary.js 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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 _jestUtil() {
  14. const data = require('jest-util');
  15. _jestUtil = function () {
  16. return data;
  17. };
  18. return data;
  19. }
  20. var _utils = require('./utils');
  21. function _interopRequireDefault(obj) {
  22. return obj && obj.__esModule ? obj : {default: obj};
  23. }
  24. /**
  25. * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  26. *
  27. * This source code is licensed under the MIT license found in the
  28. * LICENSE file in the root directory of this source tree.
  29. */
  30. const ARROW = ' \u203A ';
  31. const DOWN_ARROW = ' \u21B3 ';
  32. const DOT = ' \u2022 ';
  33. const FAIL_COLOR = _chalk().default.bold.red;
  34. const OBSOLETE_COLOR = _chalk().default.bold.yellow;
  35. const SNAPSHOT_ADDED = _chalk().default.bold.green;
  36. const SNAPSHOT_NOTE = _chalk().default.dim;
  37. const SNAPSHOT_REMOVED = _chalk().default.bold.green;
  38. const SNAPSHOT_SUMMARY = _chalk().default.bold;
  39. const SNAPSHOT_UPDATED = _chalk().default.bold.green;
  40. var _default = (snapshots, globalConfig, updateCommand) => {
  41. const summary = [];
  42. summary.push(SNAPSHOT_SUMMARY('Snapshot Summary'));
  43. if (snapshots.added) {
  44. summary.push(
  45. SNAPSHOT_ADDED(
  46. ARROW +
  47. (0, _jestUtil().pluralize)('snapshot', snapshots.added) +
  48. ' written '
  49. ) +
  50. `from ${(0, _jestUtil().pluralize)(
  51. 'test suite',
  52. snapshots.filesAdded
  53. )}.`
  54. );
  55. }
  56. if (snapshots.unmatched) {
  57. summary.push(
  58. FAIL_COLOR(
  59. `${ARROW}${(0, _jestUtil().pluralize)(
  60. 'snapshot',
  61. snapshots.unmatched
  62. )} failed`
  63. ) +
  64. ` from ${(0, _jestUtil().pluralize)(
  65. 'test suite',
  66. snapshots.filesUnmatched
  67. )}. ` +
  68. SNAPSHOT_NOTE(
  69. 'Inspect your code changes or ' + updateCommand + ' to update them.'
  70. )
  71. );
  72. }
  73. if (snapshots.updated) {
  74. summary.push(
  75. SNAPSHOT_UPDATED(
  76. ARROW +
  77. (0, _jestUtil().pluralize)('snapshot', snapshots.updated) +
  78. ' updated '
  79. ) +
  80. `from ${(0, _jestUtil().pluralize)(
  81. 'test suite',
  82. snapshots.filesUpdated
  83. )}.`
  84. );
  85. }
  86. if (snapshots.filesRemoved) {
  87. if (snapshots.didUpdate) {
  88. summary.push(
  89. SNAPSHOT_REMOVED(
  90. `${ARROW}${(0, _jestUtil().pluralize)(
  91. 'snapshot file',
  92. snapshots.filesRemoved
  93. )} removed `
  94. ) +
  95. `from ${(0, _jestUtil().pluralize)(
  96. 'test suite',
  97. snapshots.filesRemoved
  98. )}.`
  99. );
  100. } else {
  101. summary.push(
  102. OBSOLETE_COLOR(
  103. `${ARROW}${(0, _jestUtil().pluralize)(
  104. 'snapshot file',
  105. snapshots.filesRemoved
  106. )} obsolete `
  107. ) +
  108. `from ${(0, _jestUtil().pluralize)(
  109. 'test suite',
  110. snapshots.filesRemoved
  111. )}. ` +
  112. SNAPSHOT_NOTE(
  113. `To remove ${
  114. snapshots.filesRemoved === 1 ? 'it' : 'them all'
  115. }, ${updateCommand}.`
  116. )
  117. );
  118. }
  119. }
  120. if (snapshots.filesRemovedList && snapshots.filesRemovedList.length) {
  121. const [head, ...tail] = snapshots.filesRemovedList;
  122. summary.push(
  123. ` ${DOWN_ARROW} ${DOT}${(0, _utils.formatTestPath)(globalConfig, head)}`
  124. );
  125. tail.forEach(key => {
  126. summary.push(
  127. ` ${DOT}${(0, _utils.formatTestPath)(globalConfig, key)}`
  128. );
  129. });
  130. }
  131. if (snapshots.unchecked) {
  132. if (snapshots.didUpdate) {
  133. summary.push(
  134. SNAPSHOT_REMOVED(
  135. `${ARROW}${(0, _jestUtil().pluralize)(
  136. 'snapshot',
  137. snapshots.unchecked
  138. )} removed `
  139. ) +
  140. `from ${(0, _jestUtil().pluralize)(
  141. 'test suite',
  142. snapshots.uncheckedKeysByFile.length
  143. )}.`
  144. );
  145. } else {
  146. summary.push(
  147. OBSOLETE_COLOR(
  148. `${ARROW}${(0, _jestUtil().pluralize)(
  149. 'snapshot',
  150. snapshots.unchecked
  151. )} obsolete `
  152. ) +
  153. `from ${(0, _jestUtil().pluralize)(
  154. 'test suite',
  155. snapshots.uncheckedKeysByFile.length
  156. )}. ` +
  157. SNAPSHOT_NOTE(
  158. `To remove ${
  159. snapshots.unchecked === 1 ? 'it' : 'them all'
  160. }, ${updateCommand}.`
  161. )
  162. );
  163. }
  164. snapshots.uncheckedKeysByFile.forEach(uncheckedFile => {
  165. summary.push(
  166. ` ${DOWN_ARROW}${(0, _utils.formatTestPath)(
  167. globalConfig,
  168. uncheckedFile.filePath
  169. )}`
  170. );
  171. uncheckedFile.keys.forEach(key => {
  172. summary.push(` ${DOT}${key}`);
  173. });
  174. });
  175. }
  176. return summary;
  177. };
  178. exports.default = _default;