* Computes the list of unit tests to run under difference scenarios * @return {Array |void}
()
| 143 | * @return {Array<string>|void} |
| 144 | */ |
| 145 | function getUnitTestsToRun() { |
| 146 | log(green('INFO:'), 'Determining which unit tests to run...'); |
| 147 | |
| 148 | if (isLargeRefactor()) { |
| 149 | log( |
| 150 | green('INFO:'), |
| 151 | 'Skipping tests on local changes because this is a large refactor.' |
| 152 | ); |
| 153 | return; |
| 154 | } |
| 155 | |
| 156 | const tests = unitTestsToRun(); |
| 157 | if (tests.length == 0) { |
| 158 | log( |
| 159 | green('INFO:'), |
| 160 | 'No unit tests were directly affected by local changes.' |
| 161 | ); |
| 162 | return; |
| 163 | } |
| 164 | if (isCiBuild() && tests.length > TEST_FILE_COUNT_THRESHOLD) { |
| 165 | log( |
| 166 | green('INFO:'), |
| 167 | 'Several tests were affected by local changes. Running all tests below.' |
| 168 | ); |
| 169 | return; |
| 170 | } |
| 171 | |
| 172 | log(green('INFO:'), 'Running the following unit tests:'); |
| 173 | tests.forEach((test) => { |
| 174 | log(cyan(test)); |
| 175 | }); |
| 176 | |
| 177 | return tests; |
| 178 | } |
| 179 | |
| 180 | /** |
| 181 | * Extracts the list of unit tests to run based on the changes in the local |
no test coverage detected