MCPcopy Index your code
hub / github.com/devcontainers/cli / doFeaturesTestCommand

Function doFeaturesTestCommand

src/spec-node/featuresCLI/testCommandImpl.ts:42–79  ·  view source on GitHub ↗
(args: FeaturesTestCommandInput)

Source from the content-addressed store, hash-verified

40}
41
42export 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
81async function cleanup(cliHost: CLIHost) {
82 // Delete any containers that have the 'devcontainer.is_test_run=true' label set.

Callers 1

featuresTestFunction · 0.90

Calls 7

failFunction · 0.85
runGlobalFeatureTestsFunction · 0.85
runFeatureTestsFunction · 0.85
analyzeTestResultsFunction · 0.85
isFolderMethod · 0.80
cleanupFunction · 0.70
writeMethod · 0.65

Tested by

no test coverage detected