MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / runTests

Function runTests

tests/snippet-validation.test.cjs:595–765  ·  view source on GitHub ↗

* Main test runner

()

Source from the content-addressed store, hash-verified

593 * Main test runner
594 */
595async function runTests() {
596 log('=================================', 'info');
597 log('Documentation Snippet Validation', 'info');
598 log('=================================\n', 'info');
599
600 // Load cache
601 fileCache = loadCache();
602
603 if (specificFile) {
604 log(`Testing specific file: ${specificFile}\n`, 'info');
605 } else if (clearCache) {
606 log('Cache cleared - testing all files\n', 'info');
607 } else if (testAll) {
608 log('Testing all files (cache ignored)\n', 'info');
609 } else {
610 const cachedCount = Object.keys(fileCache).length;
611 if (cachedCount > 0) {
612 log(`Found cache with ${cachedCount} previously tested files\n`, 'info');
613 }
614 }
615
616 log(`Searching for documentation files in: ${DOCS_BASE_DIR}`, 'info');
617
618 let docFiles = findDocFiles();
619
620 // Filter to specific file if requested
621 if (specificFile) {
622 const absolutePath = path.isAbsolute(specificFile)
623 ? specificFile
624 : path.join(process.cwd(), specificFile);
625 docFiles = docFiles.filter(f => f === absolutePath);
626 if (docFiles.length === 0) {
627 log(`Error: File not found: ${specificFile}`, 'error');
628 process.exit(1);
629 }
630 }
631
632 log(`Found ${docFiles.length} documentation files\n`, 'info');
633
634 // Group files by cached status
635 const filesToTest = [];
636 const cachedPassedFiles = [];
637
638 for (const file of docFiles) {
639 if (isFileCached(file, fileCache)) {
640 cachedPassedFiles.push(file);
641 cachedFiles++;
642 } else {
643 filesToTest.push(file);
644 }
645 }
646
647 if (cachedPassedFiles.length > 0) {
648 log(`Skipping ${cachedPassedFiles.length} files (already passed, unchanged)`, 'dim');
649 }
650
651 if (filesToTest.length === 0) {
652 log('\n✅ All files already tested and passing!', 'success');

Callers 1

Calls 8

loadCacheFunction · 0.85
isFileCachedFunction · 0.85
getFileHashFunction · 0.85
validateSnippetFunction · 0.85
saveCacheFunction · 0.85
logFunction · 0.70
findDocFilesFunction · 0.70
extractCodeBlocksFunction · 0.70

Tested by

no test coverage detected