UNPKG

1.82 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, '__esModule', {
4 value: true
5});
6exports.default = getNoTestsFoundMessage;
7var _getNoTestFound = _interopRequireDefault(require('./getNoTestFound'));
8var _getNoTestFoundFailed = _interopRequireDefault(
9 require('./getNoTestFoundFailed')
10);
11var _getNoTestFoundPassWithNoTests = _interopRequireDefault(
12 require('./getNoTestFoundPassWithNoTests')
13);
14var _getNoTestFoundRelatedToChangedFiles = _interopRequireDefault(
15 require('./getNoTestFoundRelatedToChangedFiles')
16);
17var _getNoTestFoundVerbose = _interopRequireDefault(
18 require('./getNoTestFoundVerbose')
19);
20function _interopRequireDefault(obj) {
21 return obj && obj.__esModule ? obj : {default: obj};
22}
23/**
24 * Copyright (c) Meta Platforms, Inc. and affiliates.
25 *
26 * This source code is licensed under the MIT license found in the
27 * LICENSE file in the root directory of this source tree.
28 */
29
30function getNoTestsFoundMessage(testRunData, globalConfig) {
31 const exitWith0 =
32 globalConfig.passWithNoTests ||
33 globalConfig.lastCommit ||
34 globalConfig.onlyChanged;
35 if (globalConfig.onlyFailures) {
36 return {
37 exitWith0,
38 message: (0, _getNoTestFoundFailed.default)(globalConfig)
39 };
40 }
41 if (globalConfig.onlyChanged) {
42 return {
43 exitWith0,
44 message: (0, _getNoTestFoundRelatedToChangedFiles.default)(globalConfig)
45 };
46 }
47 if (globalConfig.passWithNoTests) {
48 return {
49 exitWith0,
50 message: (0, _getNoTestFoundPassWithNoTests.default)()
51 };
52 }
53 return {
54 exitWith0,
55 message:
56 testRunData.length === 1 || globalConfig.verbose
57 ? (0, _getNoTestFoundVerbose.default)(
58 testRunData,
59 globalConfig,
60 exitWith0
61 )
62 : (0, _getNoTestFound.default)(testRunData, globalConfig, exitWith0)
63 };
64}