( root, options: Options & TestOptions & PolicyOptions, featureFlags: Set<string> = new Set<string>(), )
| 651 | |
| 652 | // Payload to send to the Registry for scanning a package from the local filesystem. |
| 653 | async function assembleLocalPayloads( |
| 654 | root, |
| 655 | options: Options & TestOptions & PolicyOptions, |
| 656 | featureFlags: Set<string> = new Set<string>(), |
| 657 | ): Promise<Payload[]> { |
| 658 | // For --all-projects packageManager is yet undefined here. Use 'all' |
| 659 | let analysisTypeText = 'all dependencies for '; |
| 660 | if (options.docker) { |
| 661 | analysisTypeText = 'docker dependencies for '; |
| 662 | } else if (options.packageManager) { |
| 663 | analysisTypeText = options.packageManager + ' dependencies for '; |
| 664 | } |
| 665 | |
| 666 | const spinnerLbl = |
| 667 | 'Analyzing ' + |
| 668 | analysisTypeText + |
| 669 | (path.relative('.', path.join(root, options.file || '')) || |
| 670 | path.relative('..', '.') + ' project dir'); |
| 671 | |
| 672 | try { |
| 673 | const payloads: Payload[] = []; |
| 674 | await spinner.clear<void>(spinnerLbl)(); |
| 675 | if (!options.quiet) { |
| 676 | await spinner(spinnerLbl); |
| 677 | } |
| 678 | |
| 679 | const deps = await getDepsFromPlugin(root, options, featureFlags); |
| 680 | const failedResults = (deps as MultiProjectResultCustom).failedResults; |
| 681 | if (failedResults?.length) { |
| 682 | await spinner.clear<void>(spinnerLbl)(); |
| 683 | const isNotJsonOrQueiet = !options.json && !options.quiet; |
| 684 | |
| 685 | const errorMessages = extractErrorMessages( |
| 686 | failedResults, |
| 687 | isNotJsonOrQueiet, |
| 688 | ); |
| 689 | |
| 690 | if (!options.json && !options.quiet) { |
| 691 | console.warn( |
| 692 | chalk.bold.red( |
| 693 | `${icon.ISSUE} ${failedResults.length}/${ |
| 694 | failedResults.length + deps.scannedProjects.length |
| 695 | } potential projects failed to get dependencies.`, |
| 696 | ), |
| 697 | ); |
| 698 | } |
| 699 | debug( |
| 700 | 'getDepsFromPlugin returned failed results, cannot run test/monitor', |
| 701 | failedResults, |
| 702 | ); |
| 703 | |
| 704 | if ( |
| 705 | shouldPrintEffectiveDepGraphWithErrors(options) || |
| 706 | options['print-output-jsonl-with-errors'] |
| 707 | ) { |
| 708 | for (const failed of failedResults) { |
| 709 | await printDepGraphError(root, failed, process.stdout); |
| 710 | } |
no test coverage detected