1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', {
|
4 | value: true
|
5 | });
|
6 | exports.default = void 0;
|
7 |
|
8 | function _chalk() {
|
9 | const data = _interopRequireDefault(require('chalk'));
|
10 |
|
11 | _chalk = function () {
|
12 | return data;
|
13 | };
|
14 |
|
15 | return data;
|
16 | }
|
17 |
|
18 | function _jestUtil() {
|
19 | const data = require('jest-util');
|
20 |
|
21 | _jestUtil = function () {
|
22 | return data;
|
23 | };
|
24 |
|
25 | return data;
|
26 | }
|
27 |
|
28 | function _interopRequireDefault(obj) {
|
29 | return obj && obj.__esModule ? obj : {default: obj};
|
30 | }
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 | const ARROW = ' \u203A ';
|
39 | const DOT = ' \u2022 ';
|
40 |
|
41 | const FAIL_COLOR = _chalk().default.bold.red;
|
42 |
|
43 | const SNAPSHOT_ADDED = _chalk().default.bold.green;
|
44 |
|
45 | const SNAPSHOT_UPDATED = _chalk().default.bold.green;
|
46 |
|
47 | const SNAPSHOT_OUTDATED = _chalk().default.bold.yellow;
|
48 |
|
49 | var _default = (snapshot, afterUpdate) => {
|
50 | const statuses = [];
|
51 |
|
52 | if (snapshot.added) {
|
53 | statuses.push(
|
54 | SNAPSHOT_ADDED(
|
55 | ARROW +
|
56 | (0, _jestUtil().pluralize)('snapshot', snapshot.added) +
|
57 | ' written.'
|
58 | )
|
59 | );
|
60 | }
|
61 |
|
62 | if (snapshot.updated) {
|
63 | statuses.push(
|
64 | SNAPSHOT_UPDATED(
|
65 | ARROW +
|
66 | (0, _jestUtil().pluralize)('snapshot', snapshot.updated) +
|
67 | ' updated.'
|
68 | )
|
69 | );
|
70 | }
|
71 |
|
72 | if (snapshot.unmatched) {
|
73 | statuses.push(
|
74 | FAIL_COLOR(
|
75 | ARROW +
|
76 | (0, _jestUtil().pluralize)('snapshot', snapshot.unmatched) +
|
77 | ' failed.'
|
78 | )
|
79 | );
|
80 | }
|
81 |
|
82 | if (snapshot.unchecked) {
|
83 | if (afterUpdate) {
|
84 | statuses.push(
|
85 | SNAPSHOT_UPDATED(
|
86 | ARROW +
|
87 | (0, _jestUtil().pluralize)('snapshot', snapshot.unchecked) +
|
88 | ' removed.'
|
89 | )
|
90 | );
|
91 | } else {
|
92 | statuses.push(
|
93 | SNAPSHOT_OUTDATED(
|
94 | ARROW +
|
95 | (0, _jestUtil().pluralize)('snapshot', snapshot.unchecked) +
|
96 | ' obsolete'
|
97 | ) + '.'
|
98 | );
|
99 | }
|
100 |
|
101 | snapshot.uncheckedKeys.forEach(key => {
|
102 | statuses.push(` ${DOT}${key}`);
|
103 | });
|
104 | }
|
105 |
|
106 | if (snapshot.fileDeleted) {
|
107 | statuses.push(SNAPSHOT_UPDATED(ARROW + 'snapshot file removed.'));
|
108 | }
|
109 |
|
110 | return statuses;
|
111 | };
|
112 |
|
113 | exports.default = _default;
|