/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { Subject } from "../device/subject.js";
import { Test } from "../device/test.js";
import type { Container } from "../docker/container.js";
import { TestDescriptor } from "../test-descriptor.js";
import { PicsFile } from "./pics/file.js";
/**
 * CHIP test harness.
 *
 * "CHIP tests" are official tests implemented in the connectedhomeip repository.
 *
 * This harness uses Mocha to run a {@link Test} against a {@link Subject}.
 *
 * We provide utility functions for tests against in-process matter.js subjects.  But the subject interface is generic
 * and requires only setup and teardown logic, so could easily support out-of-process subjects.
 *
 * We execute test logic within a Docker container available at {@link https://github.com/matter-js/matter.js-chip}.
 */
export interface Chip {
    (subject: Subject): chip.Builder;
    (...include: string[]): chip.Builder;
    /**
     * Mocha instance.  Must be set prior to use of other methods.
     */
    mocha: undefined | Mocha;
    /**
     * Initialize.  This must run before defining tests to enable test definition via globs.
     */
    initialize(): Promise<void>;
    /**
     * Shut down.  Deactivates any active testee and removes the test container.
     */
    close(): Promise<void>;
    /**
     * Open a command pipe.
     */
    openPipe(name: string): Promise<void>;
    /**
     * Add teardown logic.
     */
    onClose(fn: () => Promise<void>): void;
    /**
     * Obtain a {@link Test} for the given name or {@link TestDescriptor}.
     */
    testFor(identifier: string | TestDescriptor): Test;
    /**
     * Default test subject.  If this is set, test implementations may omit the subject.
     */
    defaultSubject: Subject.Factory;
    /**
     * Register a {@link Subject.Factory} for a chip-test-header app name (e.g. `"all-clusters"`,
     * `"all-devices"`). When a test descriptor has an `app` field set by the descriptor generator,
     * the framework dispatches to the registered factory automatically. Manual `.subject(...)`
     * overrides on a builder still take precedence over the registry.
     */
    subjectFor(app: string, factory: Subject.Factory): void;
    /**
     * Clear the MDNS cache.
     */
    clearMdns(): Promise<void>;
    /**
     * The CHIP container.  Must be initialized before access.
     */
    container: Container;
    /**
     * The active test.  Throws if no test is running.
     */
    activeTest: Test;
    /**
     * All known CHIP tests.
     */
    tests: TestDescriptor.Filesystem;
    /**
     * Determine whether CHIP testing is initialized.
     */
    isInitialized: boolean;
    /**
     * The active PICS configuration.
     */
    defaultPics: PicsFile;
    /**
     * The filename for default PICS in the container.
     */
    defaultPicsFile: string;
    /**
     * The timeout for tests without an explicit timeout (defaults to 30s).
     */
    defaultTimeoutMs: number;
    /**
     * Set to false to disable container pull before test execution.
     */
    pullBeforeTesting: boolean;
}
export declare const chip: Chip;
export declare namespace chip {
    /**
     * The test implementation.
     */
    type TestSelection = Test | string;
    interface BeforeHook {
        (subject: Subject, test: Test): void | Promise<void>;
    }
    interface BeforeHookOptions {
        timeout?: number;
    }
    interface Builder {
        /**
         * Add tests to include.
         *
         * @param glob one or more sh-style globs for selecting tests based on ID
         */
        include(...glob: string[]): Builder;
        /**
         * Exclude tests.  Only affects tests already included.
         */
        exclude(...glob: string[]): Builder;
        /**
         * Set the test subject.  Optional if you set {@link chip.subject}.
         */
        subject(subject: Subject.Factory): Builder;
        /**
         * Execute a function after initializing but before starting the subject.
         */
        beforeStart(hook: BeforeHook): Builder;
        /**
         * Execute a function after starting the subject but before running the test.
         */
        beforeTest(hook: BeforeHook): Builder;
        /**
         * Add arguments to the test runner.
         */
        args(...args: (string | number)[]): Builder;
        /**
         * Start subject as new-from-factory rather than commissioned.
         */
        uncommissioned(): Builder;
        /**
         * Run following tests defined by this builder only.
         */
        only(): Builder;
    }
}
//# sourceMappingURL=chip.d.ts.map