# PlatformTest Class

Module
import { PlatformTest } from "@tsed/common"
Source/packages/common/src/platform-test/components/PlatformTest.ts

# Overview

class PlatformTest {
    static platformBuilder: Type<PlatformBuilder>;
    protected static _injector: InjectorService | null;
    static get injector(): InjectorService;
    static create(options?: Partial<TsED.Configuration>): Promise<void>;
    /**
     * Create a new injector with the right default services
     */
    static createInjector(options?: any): InjectorService;
    /**
     * Load the server silently without listening port and configure it on test profile.
     * @decorator
     * @param mod
     * @param options
     * @returns {Promise<void>}
     */
    static bootstrap(mod: any, options?: Partial<TsED.Configuration>): () => Promise<void>;
    /**
     * Resets the test injector of the test context, so it won't pollute your next test. Call this in your `tearDown` logic.
     */
    static reset(): Promise<void>;
    /**
     * It injects services into the test function where you can alter, spy on, and manipulate them.
     *
     * The inject function has two parameters
     *
     * * an array of Service dependency injection tokens,
     * * a test function whose parameters correspond exactly to each item in the injection token array.
     *
     * @param targets
     * @param func
     */
    static inject<T>(targets: any[], func: (...args: any[]) => Promise<T> | T): () => Promise<T>;
    /**
     * Invoke a provider and return a fresh instance
     * @param target
     * @param providers
     */
    static invoke<T = any>(target: TokenProvider, providers?: PlatformTestInvokeOptions[]): T | Promise<T>;
    /**
     * Return the instance from injector registry
     * @param target
     * @param options
     */
    static get<T = any>(target: TokenProvider, options?: any): T;
    /**
     * Return the raw application (express or koa).
     * Use this callback with SuperTest.
     *
     * ```typescript
     * let request: SuperTest.SuperTest<SuperTest.Test>;
     * beforeEach(PlatformTest.bootstrap(Server, {
     *   mount: {
     *     "/rest": [ProductsController]
     *   }
     * }));
     * beforeEach(() => {
     *   request = SuperTest(PlatformTest.callback());
     * });
     * ```
     */
    static callback(): any;
    static createRequestContext(options?: Partial<IRequestContextOptions>): RequestContext;
}