| 208 | } |
| 209 | |
| 210 | private _getTestSummary( |
| 211 | testContexts: Set<TestContext>, |
| 212 | globalConfig: Config.GlobalConfig, |
| 213 | ) { |
| 214 | const testPathPatterns = globalConfig.testPathPatterns; |
| 215 | |
| 216 | const getMatchingTestsInfo = () => { |
| 217 | const prefix = globalConfig.findRelatedTests |
| 218 | ? ' related to files matching ' |
| 219 | : ' matching '; |
| 220 | |
| 221 | return chalk.dim(prefix) + testPathPatterns.toPretty(); |
| 222 | }; |
| 223 | |
| 224 | let testInfo = ''; |
| 225 | |
| 226 | if (globalConfig.runTestsByPath) { |
| 227 | testInfo = chalk.dim(' within paths'); |
| 228 | } else if (globalConfig.onlyChanged) { |
| 229 | testInfo = chalk.dim(' related to changed files'); |
| 230 | } else if (testPathPatterns.isSet()) { |
| 231 | testInfo = getMatchingTestsInfo(); |
| 232 | } |
| 233 | |
| 234 | let nameInfo = ''; |
| 235 | |
| 236 | if (globalConfig.runTestsByPath) { |
| 237 | nameInfo = ` ${globalConfig.nonFlagArgs.map(p => `"${p}"`).join(', ')}`; |
| 238 | } else if (globalConfig.testNamePattern) { |
| 239 | nameInfo = `${chalk.dim(' with tests matching ')}"${ |
| 240 | globalConfig.testNamePattern |
| 241 | }"`; |
| 242 | } |
| 243 | |
| 244 | const contextInfo = |
| 245 | testContexts.size > 1 |
| 246 | ? chalk.dim(' in ') + testContexts.size + chalk.dim(' projects') |
| 247 | : ''; |
| 248 | |
| 249 | return ( |
| 250 | chalk.dim('Ran all test suites') + |
| 251 | testInfo + |
| 252 | nameInfo + |
| 253 | contextInfo + |
| 254 | chalk.dim('.') |
| 255 | ); |
| 256 | } |
| 257 | } |