/**
 * Copyright 2013-2026 the original author or authors from the JHipster project.
 *
 * This file is part of the JHipster project, see https://www.jhipster.tech/
 * for more information.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import type { BaseGenerator as YeomanGenerator, GetGeneratorConstructor } from '@yeoman/types';
import type { EmptyObject } from 'type-fest';
import type Environment from 'yeoman-environment';
import type { EnvironmentOptions } from 'yeoman-environment';
import { RunContext, type RunContextSettings, type RunResult, YeomanTest, createHelpers } from 'yeoman-test';
import type { CliCommand } from '../../cli/types.ts';
import type BaseApplicationGenerator from '../../generators/base-application/generator.ts';
import type { PRIORITY_NAMES as APPLICATION_PRIORITY_NAMES } from '../../generators/base-application/priorities.ts';
import BaseCoreGenerator from '../../generators/base-core/index.ts';
import type { PRIORITY_NAMES as WORKSPACES_PRIORITY_NAMES } from '../../generators/base-workspaces/priorities.ts';
import type GeneratorsByNamespace from '../../generators/types.ts';
import type { Entity } from '../jhipster/types/entity.ts';
import type { ApplicationAll } from '../types/application-all.ts';
import type { ConfigAll as ApplicationConfiguration, OptionsAll } from '../types/command-all.ts';
type GeneratorTestOptions = OptionsAll;
type WithJHipsterGenerators = {
    /**
     * Apply default mocks.
     */
    useDefaultMocks?: boolean;
    /**
     * Filter to mock a generator.
     */
    useMock?: (ns: string) => boolean;
};
type RunJHipster = WithJHipsterGenerators & {
    /**
     * Use the EnvironmentBuilder default preparation to create the environment.
     * Includes local and dev blueprints.
     */
    prepareEnvironment?: boolean;
};
type JHipsterRunResult<GeneratorType extends BaseCoreGenerator = BaseCoreGenerator> = Omit<RunResult<GeneratorType>, 'env'> & {
    env: Environment;
    /**
     * First argument of mocked source calls.
     */
    sourceCallsArg: Record<string, unknown[]>;
    /**
     * Composed generators that were mocked.
     */
    composedMockedGenerators: string[];
    createJHipster: (ns: string) => JHipsterRunContext;
    assertJHipsterConfigContent: (expected: Record<string, any>) => void;
    application?: ApplicationAll;
    entities?: Record<string, Entity>;
};
type HelpersDefaults = {
    /** Blueprint namespace */
    blueprint?: string;
    /** Path where blueprint's generators folder is located */
    blueprintPackagePath?: string;
    entrypointGenerator?: string;
};
declare const runResult: JHipsterRunResult<BaseApplicationGenerator>;
declare const coreRunResult: JHipsterRunResult;
/**
 * @deprecated see typedResult
 */
export declare const resultWithGenerator: <T extends BaseCoreGenerator>() => JHipsterRunResult<T>;
/**
 * Custom typedResult that returns a JHipsterRunResult instead of RunResult
 */
export declare const typedResult: <T extends BaseCoreGenerator>() => JHipsterRunResult<T>;
export { coreRunResult, runResult, runResult as result };
export declare const resetDefaults: () => void;
export declare const defineDefaults: (defaults?: {
    /** @deprecated mock from `node:test` is used internally */
    mockFactory?: any;
    /** @deprecated mock from `node:test` is used internally */
    accumulateMockArgs?: (mock: Record<string, any>) => Record<string, any>;
} & HelpersDefaults) => Promise<void>;
export declare const createJHipsterConfigFiles: (configuration: Record<string, unknown>, entities?: Entity[]) => Record<string, any>;
export type FakeBlueprintOptions = {
    packageJson?: any;
    generator?: string | string[];
    generatorContent?: string;
    files?: Record<string, unknown>;
};
export declare const createBlueprintFiles: (blueprintPackage: string, { packageJson, generator, generatorContent, files }?: FakeBlueprintOptions) => {
    [x: string]: any;
};
declare class JHipsterRunContext<Generator extends BaseCoreGenerator = BaseCoreGenerator> extends RunContext<Generator> {
    sharedSource: Record<string, any>;
    private sharedApplication;
    private readonly workspaceApplications;
    private commonWorkspacesConfig;
    private generateApplicationsSet;
    withOptions(options: Partial<Omit<OptionsAll, 'env' | 'resolved' | 'namespace'> & Record<string, any>>): this;
    withJHipsterConfig<Config extends EmptyObject>(configuration?: Readonly<Partial<Config & ApplicationConfiguration>>, entities?: Entity[]): this;
    withSkipWritingPriorities(): this;
    withWorkspacesCommonConfig(commonWorkspacesConfig: Record<string, unknown>): this;
    withWorkspaceApplicationAtFolder(workspaceFolder: string, configuration: Record<string, unknown>, entities?: Entity[]): this;
    withWorkspaceApplication(configuration: Record<string, unknown>, entities?: Entity[]): this;
    withWorkspacesSamples(...appNames: string[]): this;
    withGenerateWorkspaceApplications(generateWorkspaces?: boolean): this;
    withBlueprintConfig(config: Record<string, any>): this;
    /**
     * Use configured default blueprint.
     */
    withConfiguredBlueprint(): this;
    withFakeTestBlueprint(blueprintPackage: string, { packageJson, generator }?: FakeBlueprintOptions): this;
    withMockedSource(options?: {
        except?: string[];
    }): this;
    withSharedApplication(sharedApplication: Record<string, any>): this;
    withMockedNodeDependencies(): this;
    withMockedGenerators(generators: string[]): this;
    /**
     * Mock every built-in generators except the ones in the except and bootstrap-* generators.
     * Note: Bootstrap generator is mocked by default.
     * @example
     * withMockedJHipsterGenerators({ except: ['jhipster:bootstrap'] })
     * @example
     * withMockedJHipsterGenerators({ except: ['bootstrap', 'server'] })
     * @example
     * // Mock every generator including bootstrap-*
     * withMockedJHipsterGenerators({ filter: () => true })
     */
    withMockedJHipsterGenerators(options?: (keyof GeneratorsByNamespace)[] | {
        except?: (keyof GeneratorsByNamespace)[];
        filter?: (gen: keyof GeneratorsByNamespace) => boolean;
    }): this;
    withJHipsterGenerators(options?: WithJHipsterGenerators): this;
    withGradleBuildTool(): this;
    private withContextData;
    withJHipsterContextOptions(opts?: RunJHipster): this;
    withCommandName(): this;
    prepareEnvironment(): this;
    run(): Promise<RunResult<Generator>>;
    withTask(priorityName: (typeof APPLICATION_PRIORITY_NAMES)[keyof typeof APPLICATION_PRIORITY_NAMES] | (typeof WORKSPACES_PRIORITY_NAMES)[keyof typeof WORKSPACES_PRIORITY_NAMES], method: (this: BaseCoreGenerator, ...args: any[]) => any): this;
}
export declare const getCommandHelpOutput: (command?: string) => Promise<string>;
declare class JHipsterTest<JHipsterTestGenerator extends BaseCoreGenerator = BaseCoreGenerator> extends YeomanTest {
    commandName?: string;
    run<GeneratorType extends JHipsterTestGenerator = JHipsterTestGenerator>(GeneratorOrNamespace: string | GetGeneratorConstructor<GeneratorType>, settings?: RunContextSettings, envOptions?: EnvironmentOptions & {
        createEnv?: any;
    }): JHipsterRunContext<GeneratorType>;
    runDefault<Generator extends JHipsterTestGenerator = JHipsterTestGenerator>(settings?: RunContextSettings, envOptions?: EnvironmentOptions & {
        createEnv?: any;
    }): JHipsterRunContext<Generator>;
    forwardsFeaturesParameter(Generator?: any): Promise<boolean>;
    getCommandHelpOutput(commandName?: string): Promise<string>;
    runJHipster<Generator extends JHipsterTestGenerator = JHipsterTestGenerator>(jhipsterSettings?: RunJHipster, settings?: RunContextSettings, envOptions?: EnvironmentOptions): JHipsterRunContext<Generator>;
    runJHipster<Generator extends JHipsterTestGenerator = JHipsterTestGenerator>(jhipsterGenerator: string, settings?: RunContextSettings, envOptions?: EnvironmentOptions): JHipsterRunContext<Generator>;
    runJHipster<Generator extends JHipsterTestGenerator = JHipsterTestGenerator>(jhipsterGenerator: string, options?: RunJHipster): JHipsterRunContext<Generator>;
    runCli<Generator extends JHipsterTestGenerator = JHipsterTestGenerator>(command: string | string[], options?: {
        commands?: Record<string, CliCommand>;
        prepareEnvironment?: boolean;
        entrypointGenerator?: string;
    }): JHipsterRunContext<Generator>;
    runJHipsterDeployment<Generator extends JHipsterTestGenerator = JHipsterTestGenerator>(jhipsterGenerator: string, settings?: RunContextSettings, envOptions?: EnvironmentOptions): JHipsterRunContext<Generator>;
    /**
     * Run a generator in current application context.
     */
    runJHipsterInApplication<Generator extends JHipsterTestGenerator = JHipsterTestGenerator>(jhipsterGenerator: string, settings?: RunContextSettings, envOptions?: EnvironmentOptions): JHipsterRunContext<Generator>;
    runJDL<Generator extends JHipsterTestGenerator = JHipsterTestGenerator>(jdl: string, settings?: RunContextSettings, envOptions?: EnvironmentOptions): JHipsterRunContext<Generator>;
    /**
     * Run the JDL generator in current application context.
     */
    runJDLInApplication<Generator extends JHipsterTestGenerator = JHipsterTestGenerator>(jdl: string, settings?: RunContextSettings, envOptions?: EnvironmentOptions): JHipsterRunContext<Generator>;
    runTestBlueprintGenerator(): JHipsterRunContext<JHipsterTestGenerator>;
    create<GeneratorType extends YeomanGenerator<GeneratorTestOptions> = YeomanGenerator<GeneratorTestOptions>>(GeneratorOrNamespace: string | GetGeneratorConstructor<GeneratorType>, settings?: RunContextSettings, envOptions?: EnvironmentOptions): JHipsterRunContext;
    generateDeploymentWorkspaces(commonConfig?: Record<string, unknown>): JHipsterRunContext<JHipsterTestGenerator>;
    instantiateDummyBaseCoreGenerator(): Promise<BaseCoreGenerator>;
    createEnv(options: EnvironmentOptions): Promise<Environment>;
}
type HelperOptions = Omit<Parameters<typeof createHelpers>[0], 'generatorOptions'> & {
    generatorOptions?: Partial<OptionsAll>;
    commandName?: string;
};
type Presets = 'default' | 'basic' | 'skipPrettier' | 'dryRun';
export declare function createTestHelpers<JHipsterTestGenerator extends BaseCoreGenerator = BaseCoreGenerator>(preset: Presets): JHipsterTest<JHipsterTestGenerator>;
export declare function createTestHelpers<JHipsterTestGenerator extends BaseCoreGenerator = BaseCoreGenerator>(options?: HelperOptions, preset?: Presets): JHipsterTest<JHipsterTestGenerator>;
export declare const basicHelpers: JHipsterTest<BaseCoreGenerator<import("../../generators/base-core/types.js").Config, import("../../generators/base-core/types.js").Options, import("../../generators/base-core/types.js").Features>>;
export declare const defaultHelpers: JHipsterTest<BaseCoreGenerator<import("../../generators/base-core/types.js").Config, import("../../generators/base-core/types.js").Options, import("../../generators/base-core/types.js").Features>>;
export declare const skipPrettierHelpers: JHipsterTest<BaseCoreGenerator<import("../../generators/base-core/types.js").Config, import("../../generators/base-core/types.js").Options, import("../../generators/base-core/types.js").Features>>;
export declare const dryRunHelpers: JHipsterTest<BaseCoreGenerator<import("../../generators/base-core/types.js").Config, import("../../generators/base-core/types.js").Options, import("../../generators/base-core/types.js").Features>>;
