(projectFolder: string, integrationTests: boolean)
| 69 | |
| 70 | const projectsWithTests: Array<{ projectFolder: string, name: string, relativeTestPaths: string[] }> = []; |
| 71 | function addTestItemsForProject(projectFolder: string, integrationTests: boolean) { |
| 72 | if (!suites) |
| 73 | return; |
| 74 | |
| 75 | let testPaths = suites |
| 76 | .map((suite) => suite.path) |
| 77 | .filter((suitePath) => isWithinPath(suitePath, projectFolder)) |
| 78 | .filter((suitePath) => isInsideFolderNamed(suitePath, "integration_test") === integrationTests) |
| 79 | .filter((suitePath) => closestProjectFolder(suitePath) === projectFolder); |
| 80 | |
| 81 | // If we might be running all, compute if there are any exclusions in this project. If not, we |
| 82 | // can drop passing all the test names to "dart test" and just run the whole top level folder. |
| 83 | const hasExclusions = isRunningAll && exclusions?.length && !!exclusions |
| 84 | .map((node) => node.suiteData.path) |
| 85 | .filter((suitePath) => isWithinPath(suitePath, projectFolder)) |
| 86 | .filter((suitePath) => isInsideFolderNamed(suitePath, "integration_test") === integrationTests) |
| 87 | .find((suitePath) => closestProjectFolder(suitePath) === projectFolder); |
| 88 | |
| 89 | if (testPaths.length) { |
| 90 | const projectName = path.basename(projectFolder); |
| 91 | const testType = integrationTests ? "Integration Tests" : "Tests"; |
| 92 | const name = `${projectName} ${testType}`; |
| 93 | |
| 94 | // Use relative paths. |
| 95 | testPaths = testPaths.map((suitePath) => path.relative(projectFolder, suitePath)); |
| 96 | |
| 97 | // To avoid making a huge list of suite names that may trigger |
| 98 | // "The command line is too long" on Windows, if we know we're running them |
| 99 | // _all_ we can simplify the list of test names to just the top-level folders |
| 100 | // that contain each. |
| 101 | if (isRunningAll && !hasExclusions) |
| 102 | testPaths = uniq(testPaths.map((suitePath) => suitePath.split(path.sep)[0])); |
| 103 | |
| 104 | projectsWithTests.push({ projectFolder, name, relativeTestPaths: testPaths }); |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | for (const projectFolder of projectFolders) { |
| 109 | addTestItemsForProject(projectFolder, false); |
nothing calls this directly
no test coverage detected