(args: FeaturesTestCommandInput)
| 40 | } |
| 41 | |
| 42 | export async function doFeaturesTestCommand(args: FeaturesTestCommandInput): Promise<number> { |
| 43 | const { pkg, globalScenariosOnly, features, collectionFolder, cliHost } = args; |
| 44 | |
| 45 | process.stdout.write(` |
| 46 | ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ |
| 47 | | Dev Container Features | |
| 48 | │ v${pkg.version} │ |
| 49 | └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘\n\n`); |
| 50 | |
| 51 | |
| 52 | const srcDir = `${collectionFolder}/src`; |
| 53 | const testsDir = `${collectionFolder}/test`; |
| 54 | |
| 55 | if (! await cliHost.isFolder(srcDir) || ! await cliHost.isFolder(testsDir)) { |
| 56 | fail(`Folder '${collectionFolder}' does not contain the required 'src' and 'test' folders.`); |
| 57 | } |
| 58 | |
| 59 | let testResults: TestResult[] = []; |
| 60 | if (globalScenariosOnly) { |
| 61 | await runGlobalFeatureTests(args, testResults); |
| 62 | } else { |
| 63 | await runFeatureTests(args, testResults); |
| 64 | |
| 65 | // If any features were explicitly set to run, |
| 66 | // we know we don't want to run the global tests. |
| 67 | if (!features) { |
| 68 | await runGlobalFeatureTests(args, testResults); |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | // Clean up test containers |
| 73 | if (!args.preserveTestContainers) { |
| 74 | await cleanup(cliHost); |
| 75 | } |
| 76 | |
| 77 | // Pretty-print test results and exit with 0 or 1 exit code. |
| 78 | return analyzeTestResults(testResults); |
| 79 | } |
| 80 | |
| 81 | async function cleanup(cliHost: CLIHost) { |
| 82 | // Delete any containers that have the 'devcontainer.is_test_run=true' label set. |
no test coverage detected