reg-cli 0.17.6 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -107,3 +107,4 @@ The above copyright notice and this permission notice shall be included in all c
107
107
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
108
108
 
109
109
  ![reg-viz](https://raw.githubusercontent.com/reg-viz/artwork/master/repository/footer.png)
110
+
package/dist/cli.js CHANGED
@@ -1,76 +1,120 @@
1
1
  #!/usr/bin/env node
2
- 'use strict';
3
-
4
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
5
-
6
- // import notifier from './notifier';
7
-
8
-
9
- var _cliSpinner = require('cli-spinner');
10
-
11
- var _meow = require('meow');
12
-
13
- var _meow2 = _interopRequireDefault(_meow);
14
-
15
- var _path = require('path');
16
-
17
- var _path2 = _interopRequireDefault(_path);
18
-
19
- var _ = require('./');
20
-
21
- var _2 = _interopRequireDefault(_);
22
-
23
- var _log = require('./log');
24
-
25
- var _log2 = _interopRequireDefault(_log);
26
-
27
- var _fs = require('fs');
28
-
29
- var _fs2 = _interopRequireDefault(_fs);
30
-
31
- var _icon = require('./icon');
32
-
33
- var _report = require('./report');
34
-
35
- var _report2 = _interopRequireDefault(_report);
36
-
2
+ "use strict";
3
+
4
+ var _cliSpinner = require("cli-spinner");
5
+ var _meow = _interopRequireDefault(require("meow"));
6
+ var _path = _interopRequireDefault(require("path"));
7
+ var _ = _interopRequireDefault(require("./"));
8
+ var _log = _interopRequireDefault(require("./log"));
9
+ var _fs = _interopRequireDefault(require("fs"));
10
+ var _icon = require("./icon");
11
+ var _report = _interopRequireDefault(require("./report"));
37
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
38
-
13
+ // import notifier from './notifier';
39
14
  var spinner = new _cliSpinner.Spinner();
40
15
  spinner.setSpinnerString(18);
41
-
42
- var cli = (0, _meow2.default)('\n Usage\n $ reg-cli /path/to/actual-dir /path/to/expected-dir /path/to/diff-dir\n Options\n -U, --update Update expected images.(Copy `actual images` to `expected images`).\n -J, --json Specified json report path. If omitted ./reg.json.\n -I, --ignoreChange If true, error will not be thrown when image change detected.\n -E, --extendedErrors If true, also added/deleted images will throw an error. If omitted false.\n -R, --report Output html report to specified directory.\n -P, --urlPrefix Add prefix to all image src.\n -M, --matchingThreshold Matching threshold, ranges from 0 to 1. Smaller values make the comparison more sensitive. 0 by default.\n -T, --thresholdRate Rate threshold for detecting change. When the difference ratio of the image is larger than the set rate detects the change.\n -S, --thresholdPixel Pixel threshold for detecting change. When the difference pixel of the image is larger than the set pixel detects the change. This value takes precedence over `thresholdRate`.\n -C, --concurrency How many processes launches in parallel. If omitted 4.\n -A, --enableAntialias. Enable antialias. If omitted false.\n -X, --additionalDetection. Enable additional difference detection(highly experimental). Select "none" or "client" (default: "none").\n -F, --from Generate report from json. Please specify json file. If set, only report will be output without comparing images.\n -D, --customDiffMessage Pass custom massage that will logged to the terminal when there is a diff.\n Examples\n $ reg-cli /path/to/actual-dir /path/to/expected-dir /path/to/diff-dir -U -D ./reg.json\n', {
43
- alias: {
44
- U: 'update',
45
- J: 'json',
46
- I: 'ignoreChange',
47
- E: 'extendedErrors',
48
- R: 'report',
49
- P: 'urlPrefix',
50
- M: 'matchingThreshold',
51
- T: 'thresholdRate',
52
- S: 'thresholdPixel',
53
- C: 'concurrency',
54
- A: 'enableAntialias',
55
- X: 'additionalDetection',
56
- F: 'from',
57
- D: 'customDiffMessage'
16
+ var cli = (0, _meow.default)(`
17
+ Usage
18
+ $ reg-cli /path/to/actual-dir /path/to/expected-dir /path/to/diff-dir
19
+ Options
20
+ -U, --update Update expected images.(Copy \`actual images\` to \`expected images\`).
21
+ -J, --json Specified json report path. If omitted ./reg.json.
22
+ -I, --ignoreChange If true, error will not be thrown when image change detected.
23
+ -E, --extendedErrors If true, also added/deleted images will throw an error. If omitted false.
24
+ -R, --report Output html report to specified directory.
25
+ --junit Output junit report to specified file.
26
+ -P, --urlPrefix Add prefix to all image src.
27
+ -M, --matchingThreshold Matching threshold, ranges from 0 to 1. Smaller values make the comparison more sensitive. 0 by default.
28
+ -T, --thresholdRate Rate threshold for detecting change. When the difference ratio of the image is larger than the set rate detects the change.
29
+ -S, --thresholdPixel Pixel threshold for detecting change. When the difference pixel of the image is larger than the set pixel detects the change. This value takes precedence over \`thresholdRate\`.
30
+ -C, --concurrency How many processes launches in parallel. If omitted 4.
31
+ -A, --enableAntialias. Enable antialias. If omitted false.
32
+ -X, --additionalDetection. Enable additional difference detection(highly experimental). Select "none" or "client" (default: "none").
33
+ -F, --from Generate report from json. Please specify json file. If set, only report will be output without comparing images.
34
+ -D, --customDiffMessage Pass custom massage that will logged to the terminal when there is a diff.
35
+ Examples
36
+ $ reg-cli /path/to/actual-dir /path/to/expected-dir /path/to/diff-dir -U -D ./reg.json
37
+ `, {
38
+ flags: {
39
+ update: {
40
+ type: 'boolean',
41
+ alias: 'U'
42
+ },
43
+ json: {
44
+ type: 'string',
45
+ alias: 'J',
46
+ default: './reg.json'
47
+ },
48
+ ignoreChange: {
49
+ type: 'boolean',
50
+ alias: 'I'
51
+ },
52
+ extendedErrors: {
53
+ type: 'boolean',
54
+ alias: 'E',
55
+ default: false
56
+ },
57
+ report: {
58
+ type: 'string',
59
+ alias: 'R'
60
+ },
61
+ junit: {
62
+ type: 'string'
63
+ },
64
+ urlPrefix: {
65
+ type: 'string',
66
+ alias: 'P'
67
+ },
68
+ matchingThreshold: {
69
+ type: 'number',
70
+ alias: 'M',
71
+ default: 0
72
+ },
73
+ thresholdRate: {
74
+ type: 'number',
75
+ alias: 'T'
76
+ },
77
+ thresholdPixel: {
78
+ type: 'number',
79
+ alias: 'S'
80
+ },
81
+ concurrency: {
82
+ type: 'number',
83
+ alias: 'C',
84
+ default: 4
85
+ },
86
+ enableAntialias: {
87
+ type: 'boolean',
88
+ alias: 'A',
89
+ default: false
90
+ },
91
+ additionalDetection: {
92
+ type: 'string',
93
+ alias: 'X',
94
+ default: 'none'
95
+ },
96
+ from: {
97
+ type: 'string',
98
+ alias: 'F'
99
+ },
100
+ customDiffMessage: {
101
+ type: 'string',
102
+ alias: 'D'
103
+ }
58
104
  }
59
105
  });
60
106
  if (!cli.flags.from) {
61
107
  if (!process.argv[2] || !process.argv[3] || !process.argv[4]) {
62
- _log2.default.fail('please specify actual, expected and diff images directory.');
63
- _log2.default.fail('e.g.: $ reg-cli /path/to/actual-dir /path/to/expected-dir /path/to/diff-dir');
108
+ _log.default.fail('please specify actual, expected and diff images directory.');
109
+ _log.default.fail('e.g.: $ reg-cli /path/to/actual-dir /path/to/expected-dir /path/to/diff-dir');
64
110
  process.exit(1);
65
111
  }
66
112
  }
67
-
68
113
  var json = cli.flags.json ? cli.flags.json.toString() : './reg.json'; // default output path
69
114
 
70
115
  var urlPrefix = typeof cli.flags.urlPrefix === 'string' ? cli.flags.urlPrefix : './';
71
-
72
116
  var report = typeof cli.flags.report === 'string' ? cli.flags.report : !!cli.flags.report ? './report.html' : '';
73
-
117
+ var junitReport = typeof cli.flags.junit === 'string' ? cli.flags.junit : !!cli.flags.junit ? './junit.xml' : '';
74
118
  var actualDir = process.argv[2];
75
119
  var expectedDir = process.argv[3];
76
120
  var diffDir = process.argv[4];
@@ -79,96 +123,92 @@ var extendedErrors = !!cli.flags.extendedErrors;
79
123
  var ignoreChange = !!cli.flags.ignoreChange;
80
124
  var enableClientAdditionalDetection = cli.flags.additionalDetection === 'client';
81
125
  var from = String(cli.flags.from || '');
82
- var customDiffMessage = String(cli.flags.customDiffMessage || '\nInspect your code changes, re-run with `-U` to update them. ');
126
+ var customDiffMessage = String(cli.flags.customDiffMessage || `\nInspect your code changes, re-run with \`-U\` to update them. `);
83
127
 
84
128
  // If from option specified, generate report from json and exit.
85
129
  if (from) {
86
130
  var _json = '';
87
131
  try {
88
- _json = _fs2.default.readFileSync(from, { encoding: 'utf8' });
132
+ _json = _fs.default.readFileSync(from, {
133
+ encoding: 'utf8'
134
+ });
89
135
  } catch (e) {
90
- _log2.default.fail('Failed to read specify json.');
91
- _log2.default.fail(e);
136
+ _log.default.fail('Failed to read specify json.');
137
+ _log.default.fail(e);
92
138
  process.exit(1);
93
139
  }
94
-
95
140
  try {
96
141
  var params = JSON.parse(_json);
97
- (0, _report2.default)(_extends({}, params, {
142
+ (0, _report.default)({
143
+ ...params,
98
144
  json: _json || './reg.json',
99
145
  report: report || './report.html',
146
+ junitReport: junitReport || '',
147
+ extendedErrors,
100
148
  urlPrefix: urlPrefix || '',
101
- enableClientAdditionalDetection: enableClientAdditionalDetection,
149
+ enableClientAdditionalDetection,
102
150
  fromJSON: true
103
- }));
151
+ });
104
152
  process.exit(0);
105
153
  } catch (e) {
106
- _log2.default.fail('Failed to parse json. Please specify valid json.');
107
- _log2.default.fail(e);
154
+ _log.default.fail('Failed to parse json. Please specify valid json.');
155
+ _log.default.fail(e);
108
156
  process.exit(1);
109
157
  }
110
158
  }
111
-
112
- var observer = (0, _2.default)({
113
- actualDir: actualDir,
114
- expectedDir: expectedDir,
115
- diffDir: diffDir,
116
- update: update,
117
- report: report,
118
- json: json,
119
- urlPrefix: urlPrefix,
159
+ var observer = (0, _.default)({
160
+ actualDir,
161
+ expectedDir,
162
+ diffDir,
163
+ update,
164
+ report,
165
+ junitReport,
166
+ extendedErrors,
167
+ json,
168
+ urlPrefix,
120
169
  matchingThreshold: Number(cli.flags.matchingThreshold || 0),
121
170
  thresholdRate: Number(cli.flags.thresholdRate),
122
171
  thresholdPixel: Number(cli.flags.thresholdPixel),
123
172
  concurrency: Number(cli.flags.concurrency || 4),
124
173
  enableAntialias: !!cli.flags.enableAntialias,
125
- enableClientAdditionalDetection: enableClientAdditionalDetection
174
+ enableClientAdditionalDetection
126
175
  });
127
-
128
- observer.once('start', function () {
129
- return spinner.start();
130
- });
131
-
132
- observer.on('compare', function (params) {
176
+ observer.once('start', () => spinner.start());
177
+ observer.on('compare', params => {
133
178
  spinner.stop(true);
134
- var file = _path2.default.join('' + actualDir, '' + params.path);
179
+ var file = _path.default.join(`${actualDir}`, `${params.path}`);
135
180
  switch (params.type) {
136
181
  case 'delete':
137
- return _log2.default.warn(_icon.MINUS + ' delete ' + file);
182
+ return _log.default.warn(`${_icon.MINUS} delete ${file}`);
138
183
  case 'new':
139
- return _log2.default.info(_icon.GREEK_CROSS + ' append ' + file);
184
+ return _log.default.info(`${_icon.GREEK_CROSS} append ${file}`);
140
185
  case 'pass':
141
- return _log2.default.success(_icon.CHECK_MARK + ' pass ' + file);
186
+ return _log.default.success(`${_icon.CHECK_MARK} pass ${file}`);
142
187
  case 'fail':
143
- return _log2.default.fail(_icon.BALLOT_X + ' change ' + file);
188
+ return _log.default.fail(`${_icon.BALLOT_X} change ${file}`);
144
189
  }
145
190
  spinner.start();
146
191
  });
147
-
148
- observer.once('update', function () {
149
- return _log2.default.success('\u2728 your expected images are updated \u2728');
150
- });
151
-
152
- observer.once('complete', function (_ref) {
153
- var failedItems = _ref.failedItems,
154
- deletedItems = _ref.deletedItems,
155
- newItems = _ref.newItems,
156
- passedItems = _ref.passedItems;
157
-
192
+ observer.once('update', () => _log.default.success(`✨ your expected images are updated ✨`));
193
+ observer.once('complete', ({
194
+ failedItems,
195
+ deletedItems,
196
+ newItems,
197
+ passedItems
198
+ }) => {
158
199
  spinner.stop(true);
159
- _log2.default.info('\n');
160
- if (failedItems.length) _log2.default.fail(_icon.BALLOT_X + ' ' + failedItems.length + ' file(s) changed.');
161
- if (deletedItems.length) _log2.default.warn(_icon.MINUS + ' ' + deletedItems.length + ' file(s) deleted.');
162
- if (newItems.length) _log2.default.info(_icon.GREEK_CROSS + ' ' + newItems.length + ' file(s) appended.');
163
- if (passedItems.length) _log2.default.success(_icon.CHECK_MARK + ' ' + passedItems.length + ' file(s) passed.');
200
+ _log.default.info('\n');
201
+ if (failedItems.length) _log.default.fail(`${_icon.BALLOT_X} ${failedItems.length} file(s) changed.`);
202
+ if (deletedItems.length) _log.default.warn(`${_icon.MINUS} ${deletedItems.length} file(s) deleted.`);
203
+ if (newItems.length) _log.default.info(`${_icon.GREEK_CROSS} ${newItems.length} file(s) appended.`);
204
+ if (passedItems.length) _log.default.success(`${_icon.CHECK_MARK} ${passedItems.length} file(s) passed.`);
164
205
  if (!update && (failedItems.length > 0 || extendedErrors && (newItems.length > 0 || deletedItems.length > 0))) {
165
- _log2.default.fail(customDiffMessage);
206
+ _log.default.fail(customDiffMessage);
166
207
  if (!ignoreChange) process.exit(1);
167
208
  }
168
209
  return process.exit(0);
169
210
  });
170
-
171
- observer.once('error', function (error) {
172
- _log2.default.fail(error);
211
+ observer.once('error', error => {
212
+ _log.default.fail(error);
173
213
  process.exit(1);
174
214
  });
package/dist/diff.js CHANGED
@@ -1,37 +1,24 @@
1
- 'use strict';
2
-
3
- var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); // $FlowIgnore
4
- // $FlowIgnore
5
-
6
-
7
- var _imgDiffJs = require('img-diff-js');
8
-
9
- var _md5File = require('md5-file');
10
-
11
- var _md5File2 = _interopRequireDefault(_md5File);
12
-
13
- var _path = require('path');
14
-
15
- var _path2 = _interopRequireDefault(_path);
1
+ "use strict";
16
2
 
3
+ var _imgDiffJs = require("img-diff-js");
4
+ var _md5File = _interopRequireDefault(require("md5-file"));
5
+ var _path = _interopRequireDefault(require("path"));
17
6
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
-
19
- var getMD5 = function getMD5(file) {
20
- return new Promise(function (resolve, reject) {
21
- (0, _md5File2.default)(file, function (err, hash) {
22
- if (err) reject(err);
23
- resolve(hash);
24
- });
7
+ // $FlowIgnore
8
+ // $FlowIgnore
9
+ var getMD5 = file => new Promise((resolve, reject) => {
10
+ (0, _md5File.default)(file, (err, hash) => {
11
+ if (err) reject(err);
12
+ resolve(hash);
25
13
  });
26
- };
27
-
28
- var isPassed = function isPassed(_ref) {
29
- var width = _ref.width,
30
- height = _ref.height,
31
- diffCount = _ref.diffCount,
32
- thresholdPixel = _ref.thresholdPixel,
33
- thresholdRate = _ref.thresholdRate;
34
-
14
+ });
15
+ var isPassed = ({
16
+ width,
17
+ height,
18
+ diffCount,
19
+ thresholdPixel,
20
+ thresholdRate
21
+ }) => {
35
22
  if (typeof thresholdPixel === "number") {
36
23
  return diffCount <= thresholdPixel;
37
24
  } else if (typeof thresholdRate === "number") {
@@ -41,47 +28,53 @@ var isPassed = function isPassed(_ref) {
41
28
  }
42
29
  return diffCount === 0;
43
30
  };
44
-
45
- var createDiff = function createDiff(_ref2) {
46
- var actualDir = _ref2.actualDir,
47
- expectedDir = _ref2.expectedDir,
48
- diffDir = _ref2.diffDir,
49
- image = _ref2.image,
50
- matchingThreshold = _ref2.matchingThreshold,
51
- thresholdRate = _ref2.thresholdRate,
52
- thresholdPixel = _ref2.thresholdPixel,
53
- enableAntialias = _ref2.enableAntialias;
54
-
55
- return Promise.all([getMD5(_path2.default.join(actualDir, image)), getMD5(_path2.default.join(expectedDir, image))]).then(function (_ref3) {
56
- var _ref4 = _slicedToArray(_ref3, 2),
57
- actualHash = _ref4[0],
58
- expectedHash = _ref4[1];
59
-
31
+ var createDiff = ({
32
+ actualDir,
33
+ expectedDir,
34
+ diffDir,
35
+ image,
36
+ matchingThreshold,
37
+ thresholdRate,
38
+ thresholdPixel,
39
+ enableAntialias
40
+ }) => {
41
+ return Promise.all([getMD5(_path.default.join(actualDir, image)), getMD5(_path.default.join(expectedDir, image))]).then(([actualHash, expectedHash]) => {
60
42
  if (actualHash === expectedHash) {
61
43
  if (!process || !process.send) return;
62
- return process.send({ passed: true, image: image });
44
+ return process.send({
45
+ passed: true,
46
+ image
47
+ });
63
48
  }
64
49
  var diffImage = image.replace(/\.[^\.]+$/, ".png");
65
50
  return (0, _imgDiffJs.imgDiff)({
66
- actualFilename: _path2.default.join(actualDir, image),
67
- expectedFilename: _path2.default.join(expectedDir, image),
68
- diffFilename: _path2.default.join(diffDir, diffImage),
51
+ actualFilename: _path.default.join(actualDir, image),
52
+ expectedFilename: _path.default.join(expectedDir, image),
53
+ diffFilename: _path.default.join(diffDir, diffImage),
69
54
  options: {
70
55
  threshold: matchingThreshold,
71
56
  includeAA: !enableAntialias
72
57
  }
73
- }).then(function (_ref5) {
74
- var width = _ref5.width,
75
- height = _ref5.height,
76
- diffCount = _ref5.diffCount;
77
-
78
- var passed = isPassed({ width: width, height: height, diffCount: diffCount, thresholdPixel: thresholdPixel, thresholdRate: thresholdRate });
58
+ }).then(({
59
+ width,
60
+ height,
61
+ diffCount
62
+ }) => {
63
+ var passed = isPassed({
64
+ width,
65
+ height,
66
+ diffCount,
67
+ thresholdPixel,
68
+ thresholdRate
69
+ });
79
70
  if (!process || !process.send) return;
80
- process.send({ passed: passed, image: image });
71
+ process.send({
72
+ passed,
73
+ image
74
+ });
81
75
  });
82
76
  });
83
77
  };
84
-
85
- process.on('message', function (data) {
78
+ process.on('message', data => {
86
79
  createDiff(data);
87
80
  });
package/dist/icon.js CHANGED
@@ -1,8 +1,9 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.TEARDROP = exports.MULTIPLICATION_X = exports.MINUS = exports.GREEK_CROSS = exports.CHECK_MARK = exports.BALLOT_X = void 0;
6
7
  var BALLOT_X = exports.BALLOT_X = '\u2718';
7
8
  var CHECK_MARK = exports.CHECK_MARK = '\u2714';
8
9
  var TEARDROP = exports.TEARDROP = '\u274B';
@@ -1,46 +1,25 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.findImages = undefined;
7
-
8
- var _glob = require('glob');
9
-
10
- var _glob2 = _interopRequireDefault(_glob);
11
-
12
- var _path = require('path');
13
-
14
- var _path2 = _interopRequireDefault(_path);
15
-
6
+ exports.findImages = void 0;
7
+ var _glob = _interopRequireDefault(require("glob"));
8
+ var _path = _interopRequireDefault(require("path"));
16
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
- var difference = function difference(arrA, arrB) {
19
- return arrA.filter(function (a) {
20
- return !arrB.includes(a);
21
- });
22
- }; // $FlowIgnore
23
-
24
-
10
+ // $FlowIgnore
11
+ var difference = (arrA, arrB) => arrA.filter(a => !arrB.includes(a));
25
12
  var IMAGE_FILES = '/**/*.+(tiff|jpeg|jpg|gif|png|bmp)';
26
-
27
- var findImages = exports.findImages = function findImages(expectedDir, actualDir) {
28
- var expectedImages = _glob2.default.sync('' + expectedDir + IMAGE_FILES).map(function (p) {
29
- return _path2.default.relative(expectedDir, p);
30
- }).map(function (p) {
31
- return p[0] === _path2.default.sep ? p.slice(1) : p;
32
- });
33
- var actualImages = _glob2.default.sync('' + actualDir + IMAGE_FILES).map(function (p) {
34
- return _path2.default.relative(actualDir, p);
35
- }).map(function (p) {
36
- return p[0] === _path2.default.sep ? p.slice(1) : p;
37
- });
13
+ var findImages = (expectedDir, actualDir) => {
14
+ var expectedImages = _glob.default.sync(`${expectedDir}${IMAGE_FILES}`).map(p => _path.default.relative(expectedDir, p)).map(p => p[0] === _path.default.sep ? p.slice(1) : p);
15
+ var actualImages = _glob.default.sync(`${actualDir}${IMAGE_FILES}`).map(p => _path.default.relative(actualDir, p)).map(p => p[0] === _path.default.sep ? p.slice(1) : p);
38
16
  var deletedImages = difference(expectedImages, actualImages);
39
17
  var newImages = difference(actualImages, expectedImages);
40
18
  return {
41
- expectedImages: expectedImages,
42
- actualImages: actualImages,
43
- deletedImages: deletedImages,
44
- newImages: newImages
19
+ expectedImages,
20
+ actualImages,
21
+ deletedImages,
22
+ newImages
45
23
  };
46
- };
24
+ };
25
+ exports.findImages = findImages;