/*! * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ import { type Logger, type Package } from "@fluidframework/build-tools"; import { type SourceFile } from "ts-morph"; import { PackageCommand } from "../../BasePackageCommand.js"; import type { PackageSelectionDefault } from "../../flags.js"; import { ApiLevel } from "../../library/index.js"; import type { TypeData } from "../../typeValidator/typeData.js"; import { type BrokenCompatSettings, type PackageWithTypeTestSettings } from "../../typeValidator/typeValidatorConfig.js"; export default class GenerateTypetestsCommand extends PackageCommand { static readonly description = "Generates type tests for a package or group of packages."; static readonly flags: { readonly private: import("@oclif/core/interfaces").BooleanFlag; readonly scope: import("@oclif/core/interfaces").OptionFlag; readonly skipScope: import("@oclif/core/interfaces").OptionFlag; readonly all: import("@oclif/core/interfaces").BooleanFlag; readonly dir: import("@oclif/core/interfaces").OptionFlag; readonly packages: import("@oclif/core/interfaces").BooleanFlag; readonly releaseGroup: import("@oclif/core/interfaces").OptionFlag<("client" | "server" | "build-tools" | "all" | "gitrest" | "historian")[] | undefined, import("@oclif/core/interfaces").CustomOptions>; readonly releaseGroupRoot: import("@oclif/core/interfaces").OptionFlag<("client" | "server" | "build-tools" | "all" | "gitrest" | "historian")[] | undefined, import("@oclif/core/interfaces").CustomOptions>; readonly changed: import("@oclif/core/interfaces").BooleanFlag; readonly branch: import("@oclif/core/interfaces").OptionFlag; readonly concurrency: import("@oclif/core/interfaces").OptionFlag; readonly entrypoint: import("@oclif/core/interfaces").OptionFlag; readonly outDir: import("@oclif/core/interfaces").OptionFlag; readonly outFile: import("@oclif/core/interfaces").OptionFlag; readonly publicFallback: import("@oclif/core/interfaces").BooleanFlag; }; protected defaultSelection: PackageSelectionDefault; protected processPackage(pkg: Package): Promise; } /** * Extracts type data from a TS source file and creates a map where each key is a type name and the value is its type * data. * * @param file - The source code file containing type data. * @param log - A logger to use. * @returns The mapping between type name and its type data. */ export declare function typeDataFromFile(file: SourceFile, log: Logger, namespacePrefix?: string): Map; /** * Loads a ts-morph source file from the provided path. * * @param typesPath - The path to the types file to load. * @returns The loaded source file. */ export declare function loadTypesSourceFile(typesPath: string): SourceFile; /** * Generates compatibility test cases using the provided type data to validate forward and backward compatibility of * types. The type data is assumed to be from an _older_ version of the types. This function will construct test cases * that import the types from both the old/previous version of a package and the current version and use them in place * of one another. Failed test cases indicate type incompatibility between versions. * * @param typeMap - map containing type data to use to generate type tests * @param packageObject - package.json object containing type validation settings * @returns - string array representing generated compatibility test cases */ export declare function generateCompatibilityTestCases(typeMap: Map, packageObject: PackageWithTypeTestSettings): string[]; /** * Internals of {@link generateCompatibilityTestCases} for a single type. * * @param typeData - The type to test. * @param brokenData - Expected broken compatibilities, if any. * @returns Lines of TypeScript code that make up the compatibility test. */ export declare function generateCompatibilityTestCase(typeData: TypeData, brokenData: BrokenCompatSettings | undefined): string[]; //# sourceMappingURL=typetests.d.ts.map