1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', {
|
4 | value: true
|
5 | });
|
6 | exports.default = getChangedFilesPromise;
|
7 | function _chalk() {
|
8 | const data = _interopRequireDefault(require('chalk'));
|
9 | _chalk = function () {
|
10 | return data;
|
11 | };
|
12 | return data;
|
13 | }
|
14 | function _jestChangedFiles() {
|
15 | const data = require('jest-changed-files');
|
16 | _jestChangedFiles = function () {
|
17 | return data;
|
18 | };
|
19 | return data;
|
20 | }
|
21 | function _jestMessageUtil() {
|
22 | const data = require('jest-message-util');
|
23 | _jestMessageUtil = function () {
|
24 | return data;
|
25 | };
|
26 | return data;
|
27 | }
|
28 | function _interopRequireDefault(obj) {
|
29 | return obj && obj.__esModule ? obj : {default: obj};
|
30 | }
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 | function getChangedFilesPromise(globalConfig, configs) {
|
39 | if (globalConfig.onlyChanged) {
|
40 | const allRootsForAllProjects = configs.reduce((roots, config) => {
|
41 | if (config.roots) {
|
42 | roots.push(...config.roots);
|
43 | }
|
44 | return roots;
|
45 | }, []);
|
46 | return (0, _jestChangedFiles().getChangedFilesForRoots)(
|
47 | allRootsForAllProjects,
|
48 | {
|
49 | changedSince: globalConfig.changedSince,
|
50 | lastCommit: globalConfig.lastCommit,
|
51 | withAncestor: globalConfig.changedFilesWithAncestor
|
52 | }
|
53 | ).catch(e => {
|
54 | const message = (0, _jestMessageUtil().formatExecError)(e, configs[0], {
|
55 | noStackTrace: true
|
56 | })
|
57 | .split('\n')
|
58 | .filter(line => !line.includes('Command failed:'))
|
59 | .join('\n');
|
60 | console.error(_chalk().default.red(`\n\n${message}`));
|
61 | process.exit(1);
|
62 | });
|
63 | }
|
64 | return undefined;
|
65 | }
|