/*! * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ import type { Package } from "@fluidframework/build-tools"; import { PackageCommand } from "../BasePackageCommand.js"; import type { PackageWithKind } from "../filter.js"; import type { PackageSelectionDefault } from "../flags.js"; interface FilterCommandResult { selected: Pick[]; filtered: Pick[]; } /** * This command is used to test the common package filtering and selection logic that is used across the CLI. It * subclasses PackageCommand and outputs JSON containing metadata about the packages selected and filtered. This output * is parsed in tests. * * It may not be obvious why these command-level tests are needed in addition to testing the functions that do most of * the filtering (see ../filter.test.ts). The reason is that the code to translate oclif's flags into selection/filter * objects lives in the PackageCommand command. There's no way (that I know of) to mock an oclif command's flags. * * Instead, this test command is a real command, and the tests call it using the oclif command test infrastructure. This * ensures that we are testing the complete pipeline from command flag parsing, to creating selection/filter objects * from the flags, through applying to those filters to the packages in the repo. * * While the --json flag is technically optional, it should always be passed when using this command for testing. * Otherwise there is no output to be checked for correctness. */ export default class FilterCommand extends PackageCommand { static readonly summary = "FOR INTERNAL TESTING ONLY. This command is used only to test the common package filtering and selection logic that is used across the CLI. FOR INTERNAL TESTING ONLY."; static readonly description = "This command outputs JSON containing metadata about the packages selected and filtered. This output is parsed in tests. While the --json flag is technically optional, it should always be passed when using this command for testing. Otherwise there is no output to be checked for correctness."; static readonly hidden = true; static readonly enableJsonFlag = true; protected defaultSelection: PackageSelectionDefault; protected processPackage(_pkg: Package): Promise; protected processPackages(_packages: PackageWithKind[]): Promise; run(): Promise; } export {}; //# sourceMappingURL=test-only-filter.d.ts.map