UNPKG

1.76 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, '__esModule', {
4 value: true
5});
6exports.default = void 0;
7
8function _chalk() {
9 const data = _interopRequireDefault(require('chalk'));
10
11 _chalk = function () {
12 return data;
13 };
14
15 return data;
16}
17
18function _jestChangedFiles() {
19 const data = require('jest-changed-files');
20
21 _jestChangedFiles = function () {
22 return data;
23 };
24
25 return data;
26}
27
28function _jestMessageUtil() {
29 const data = require('jest-message-util');
30
31 _jestMessageUtil = function () {
32 return data;
33 };
34
35 return data;
36}
37
38function _interopRequireDefault(obj) {
39 return obj && obj.__esModule ? obj : {default: obj};
40}
41
42/**
43 * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
44 *
45 * This source code is licensed under the MIT license found in the
46 * LICENSE file in the root directory of this source tree.
47 */
48var _default = (globalConfig, configs) => {
49 if (globalConfig.onlyChanged) {
50 const allRootsForAllProjects = configs.reduce((roots, config) => {
51 if (config.roots) {
52 roots.push(...config.roots);
53 }
54
55 return roots;
56 }, []);
57 return (0, _jestChangedFiles().getChangedFilesForRoots)(
58 allRootsForAllProjects,
59 {
60 changedSince: globalConfig.changedSince,
61 lastCommit: globalConfig.lastCommit,
62 withAncestor: globalConfig.changedFilesWithAncestor
63 }
64 ).catch(e => {
65 const message = (0, _jestMessageUtil().formatExecError)(e, configs[0], {
66 noStackTrace: true
67 })
68 .split('\n')
69 .filter(line => !line.includes('Command failed:'))
70 .join('\n');
71 console.error(_chalk().default.red(`\n\n${message}`));
72 process.exit(1);
73 });
74 }
75
76 return undefined;
77};
78
79exports.default = _default;