mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Implement e2e tests
This commit is contained in:
parent
f817bf887a
commit
059cba06bc
17 changed files with 163 additions and 293 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import { commandArgumentScanner } from "./dependencyScanner/commandArgumentScanner.js";
|
||||
import { nullScanner } from "./dependencyScanner/nullScanner.js";
|
||||
import { runPip } from "./runPipCommand.js";
|
||||
import {
|
||||
getPipCommandForArgs,
|
||||
|
|
@ -9,8 +8,7 @@ import {
|
|||
} from "./utils/pipCommands.js";
|
||||
|
||||
/**
|
||||
* Creates a package manager interface for Python's pip package installer
|
||||
*
|
||||
* Creates a package manager
|
||||
* @param {string} [command="pip"] - The pip command to use (e.g., "pip", "pip3") defaults to "pip"
|
||||
*/
|
||||
export function createPipPackageManager(command = "pip") {
|
||||
|
|
@ -41,15 +39,20 @@ const commandScannerMapping = {
|
|||
[pipInstallCommand]: commandArgumentScanner(),
|
||||
[pipDownloadCommand]: commandArgumentScanner(), // download also fetches packages from PyPI
|
||||
[pipWheelCommand]: commandArgumentScanner(), // wheel downloads and builds packages
|
||||
// Other commands (uninstall, list, etc.) will use nullScanner() by default
|
||||
// Other commands return null scanner by default
|
||||
};
|
||||
|
||||
const NULL_SCANNER = {
|
||||
shouldScan: () => false,
|
||||
scan: () => [],
|
||||
};
|
||||
|
||||
function findDependencyScannerForCommand(scanners, args) {
|
||||
const command = getPipCommandForArgs(args);
|
||||
if (!command) {
|
||||
return nullScanner();
|
||||
return NULL_SCANNER;
|
||||
}
|
||||
|
||||
const scanner = scanners[command];
|
||||
return scanner ? scanner : nullScanner();
|
||||
return scanner || NULL_SCANNER;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue