text:
// Type definitions for Jest 24.0
// Project: https://jestjs.io
// Definitions by: Asana <https://asana.com>
//                 Ivo Stratev <https://github.com/NoHomey>
//                 jwbay <https://github.com/jwbay>
//                 Alexey Svetliakov <https://github.com/asvetliakov>
//                 Alex Jover Morales <https://github.com/alexjoverm>
//                 Allan Lukwago <https://github.com/epicallan>
//                 Ika <https://github.com/ikatyang>
//                 Waseem Dahman <https://github.com/wsmd>
//                 Jamie Mason <https://github.com/JamieMason>
//                 Douglas Duteil <https://github.com/douglasduteil>
//                 Ahn <https://github.com/ahnpnl>
//                 Josh Goldberg <https://github.com/joshuakgoldberg>
//                 Jeff Lau <https://github.com/UselessPickles>
//                 Andrew Makarov <https://github.com/r3nya>
//                 Martin Hochel <https://github.com/hotell>
//                 Sebastian Sebald <https://github.com/sebald>
//                 Andy <https://github.com/andys8>
//                 Antoine Brault <https://github.com/antoinebrault>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0

/// <reference types="jest-diff" />

declare var beforeAll: jest.Lifecycle;
declare var beforeEach: jest.Lifecycle;
declare var afterAll: jest.Lifecycle;
declare var afterEach: jest.Lifecycle;
declare var describe: jest.Describe;
declare var fdescribe: jest.Describe;
declare var xdescribe: jest.Describe;
declare var it: jest.It;
declare var fit: jest.It;
declare var xit: jest.It;
declare var test: jest.It;
declare var xtest: jest.It;

declare const expect: jest.Expect;

interface NodeRequire {
    /**
     * Returns the actual module instead of a mock, bypassing all checks on
     * whether the module should receive a mock implementation or not.
     *
     * @deprecated Use `jest.requireActual` instead.
     */
    requireActual(moduleName: string): any;
    /**
     * Returns a mock module instead of the actual module, bypassing all checks
     * on whether the module should be required normally or not.
     *
     * @deprecated Use `jest.requireMock`instead.
     */
    requireMock(moduleName: string): any;
}

declare namespace jest {
    /**
     * Provides a way to add Jasmine-compatible matchers into your Jest context.
     */
    function addMatchers(matchers: jasmine.CustomMatcherFactories): typeof jest;
    /**
     * Disables automatic mocking in the module loader.
     */
    function autoMockOff(): typeof jest;
    /**
     * Enables automatic mocking in the module loader.
     */
    function autoMockOn(): typeof jest;
    /**
     * Clears the mock.calls and mock.instances properties of all mocks.
     * Equivalent to calling .mockClear() on every mocked function.
     */
    function clearAllMocks(): typeof jest;
    /**
     * Resets the state of all mocks.
     * Equivalent to calling .mockReset() on every mocked function.
     */
    function resetAllMocks(): typeof jest;
    /**
     * available since Jest 21.1.0
     * Restores all mocks back to their original value.
     * Equivalent to calling .mockRestore on every mocked function.
     * Beware that jest.restoreAllMocks() only works when mock was created with
     * jest.spyOn; other mocks will require you to manually restore them.
     */
    function restoreAllMocks(): typeof jest;
    /**
     * Removes any pending timers from the timer system. If any timers have
     * been scheduled, they will be cleared and will never have the opportunity
     * to execute in the future.
     */
    function clearAllTimers(): typeof jest;
    /**
     * Indicates that the module system should never return a mocked version
     * of the specified module, including all of the specificied module's dependencies.
     */
    function deepUnmock(moduleName: string): typeof jest;
    /**
     * Disables automatic mocking in the module loader.
     */
    function disableAutomock(): typeof jest;
    /**
     * Mocks a module with an auto-mocked version when it is being required.
     */
    function doMock(moduleName: string, factory?: any, options?: MockOptions): typeof jest;
    /**
     * Indicates that the module system should never return a mocked version
     * of the specified module from require() (e.g. that it should always return the real module).
     */
    function dontMock(moduleName: string): typeof jest;
    /**
     * Enables automatic mocking in the module loader.
     */
    function enableAutomock(): typeof jest;
    /**
     * Creates a mock function. Optionally takes a mock implementation.
     */
    function fn(): Mock;
    /**
     * Creates a mock function. Optionally takes a mock implementation.
     */
    function fn<T, Y extends any[]>(implementation?: (...args: Y) => T): Mock<T, Y>;
    /**
     * Use the automatic mocking system to generate a mocked version of the given module.
     */
    function genMockFromModule<T>(moduleName: string): T;
    /**
     * Returns whether the given function is a mock function.
     */
    function isMockFunction(fn: any): fn is Mock;
    /**
     * Mocks a module with an auto-mocked version when it is being required.
     */
    function mock(moduleName: string, factory?: any, options?: MockOptions): typeof jest;
    /**
     * Returns the actual module instead of a mock, bypassing all checks on
     * whether the module should receive a mock implementation or not.
     */
    function requireActual(moduleName: string): any;
    /**
     * Returns a mock module instead of the actual module, bypassing all checks
     * on whether the module should be required normally or not.
     */
    function requireMock(moduleName: string): any;
    /**
     * Resets the module registry - the cache of all required modules. This is
     * useful to isolate modules where local state might conflict between tests.
     */
    function resetModuleRegistry(): typeof jest;
    /**
     * Resets the module registry - the cache of all required modules. This is
     * useful to isolate modules where local state might conflict between tests.
     */
    function resetModules(): typeof jest;
    /**
     * Creates a sandbox registry for the modules that are loaded inside the callback function..
     * This is useful to isolate specific modules for every test so that local module state doesn't conflict between tests.
     */
    function isolateModules(fn: () => void): typeof jest;
    /**
     * Runs failed tests n-times until they pass or until the max number of retries is exhausted.
     * This only works with jest-circus!
     */
    function retryTimes(numRetries: number): typeof jest;
    /**
     * Exhausts tasks queued by setImmediate().
     */
    function runAllImmediates(): typeof jest;
    /**
     * Exhausts the micro-task queue (usually interfaced in node via process.nextTick).
     */
    function runAllTicks(): typeof jest;
    /**
     * Exhausts the macro-task queue (i.e., all tasks queued by setTimeout() and setInterval()).
     */
    function runAllTimers(): typeof jest;
    /**
     * Executes only the macro-tasks that are currently pending (i.e., only the
     * tasks that have been queued by setTimeout() or setInterval() up to this point).
     * If any of the currently pending macro-tasks schedule new macro-tasks,
     * those new tasks will not be executed by this call.
     */
    function runOnlyPendingTimers(): typeof jest;
    /**
     * (renamed to `advanceTimersByTime` in Jest 21.3.0+) Executes only the macro
     * task queue (i.e. all tasks queued by setTimeout() or setInterval() and setImmediate()).
     */
    function runTimersToTime(msToRun: number): typeof jest;
    /**
     * Advances all timers by msToRun milliseconds. All pending "macro-tasks" that have been
     * queued via setTimeout() or setInterval(), and would be executed within this timeframe
     * will be executed.
     */
    function advanceTimersByTime(msToRun: number): typeof jest;
    /**
     * Explicitly supplies the mock object that the module system should return
     * for the specified module.
     */
    function setMock<T>(moduleName: string, moduleExports: T): typeof jest;
    /**
     * Set the default timeout interval for tests and before/after hooks in milliseconds.
     * Note: The default timeout interval is 5 seconds if this method is not called.
     */
    function setTimeout(timeout: number): typeof jest;
    /**
     * Creates a mock function similar to jest.fn but also tracks calls to `object[methodName]`
     *
     * Note: By default, jest.spyOn also calls the spied method. This is different behavior from most
     * other test libraries.
     *
     * @example
     *
     * const video = require('./video');
     *
     * test('plays video', () => {
     *   const spy = jest.spyOn(video, 'play');
     *   const isPlaying = video.play();
     *
     *   expect(spy).toHaveBeenCalled();
     *   expect(isPlaying).toBe(true);
     *
     *   spy.mockReset();
     *   spy.mockRestore();
     * });
     */
    function spyOn<T extends {}, M extends NonFunctionPropertyNames<Required<T>>>(object: T, method: M, accessType: 'get'): SpyInstance<Required<T>[M], []>;
    function spyOn<T extends {}, M extends NonFunctionPropertyNames<Required<T>>>(object: T, method: M, accessType: 'set'): SpyInstance<void, [Required<T>[M]]>;
    function spyOn<T extends {}, M extends FunctionPropertyNames<Required<T>>>(object: T, method: M): Required<T>[M] extends (...args: any[]) => any ?
        SpyInstance<ReturnType<Required<T>[M]>, ArgsType<Required<T>[M]>> : never;
    /**
     * Indicates that the module system should never return a mocked version of
     * the specified module from require() (e.g. that it should always return the real module).
     */
    function unmock(moduleName: string): typeof jest;
    /**
     * Instructs Jest to use fake versions of the standard timer functions.
     */
    function useFakeTimers(): typeof jest;
    /**
     * Instructs Jest to use the real versions of the standard timer functions.
     */
    function useRealTimers(): typeof jest;

    interface MockOptions {
        virtual?: boolean;
    }

    type EmptyFunction = () => void;
    type ArgsType<T> = T extends (...args: infer A) => any ? A : never;
    type RejectedValue<T> = T extends PromiseLike<any> ? any : never;
    type ResolvedValue<T> = T extends PromiseLike<infer U> ? U | T : never;
    // see https://github.com/Microsoft/TypeScript/issues/25215
    type NonFunctionPropertyNames<T> = { [K in keyof T]: T[K] extends (...args: any[]) => any ? never : K }[keyof T] & string;
    type FunctionPropertyNames<T> = { [K in keyof T]: T[K] extends (...args: any[]) => any ? K : never }[keyof T] & string;

    interface DoneCallback {
        (...args: any[]): any;
        fail(error?: string | { message: string }): any;
    }

    type ProvidesCallback = (cb: DoneCallback) => any;

    type Lifecycle = (fn: ProvidesCallback, timeout?: number) => any;

    interface FunctionLike {
        readonly name: string;
    }

    interface Each {
        // Exclusively arrays.
        <T extends any[]>(cases: ReadonlyArray<T>): (
            name: string,
            fn: (...args: T) => any,
            timeout?: number
        ) => void;
        // Not arrays.
        <T>(cases: ReadonlyArray<T>): (
            name: string,
            fn: (...args: T[]) => any,
            timeout?: number
        ) => void;
        (cases: ReadonlyArray<ReadonlyArray<any>>): (
            name: string,
            fn: (...args: any[]) => any,
            timeout?: number
        ) => void;
        (strings: TemplateStringsArray, ...placeholders: any[]): (
            name: string,
            fn: (arg: any) => any,
            timeout?: number
        ) => void;
    }

    /**
     * Creates a test closure
     */
    interface It {
        /**
         * Creates a test closure.
         *
         * @param name The name of your test
         * @param fn The function for your test
         * @param timeout The timeout for an async function test
         */
        (name: string, fn?: ProvidesCallback, timeout?: number): void;
        /**
         * Only runs this test in the current file.
         */
        only: It;
        /**
         * Skips running this test in the current file.
         */
        skip: It;
        /**
         * Sketch out which tests to write in the future.
         */
        todo: It;
        /**
         * Experimental and should be avoided.
         */
        concurrent: It;
        /**
         * Use if you keep duplicating the same test with different data. `.each` allows you to write the
         * test once and pass data in.
         *
         * `.each` is available with two APIs:
         *
         * #### 1  `test.each(table)(name, fn)`
         *
         * - `table`: Array of Arrays with the arguments that are passed into the test fn for each row.
         * - `name`: String the title of the test block.
         * - `fn`: Function the test to be ran, this is the function that will receive the parameters in each row as function arguments.
         *
         *
         * #### 2  `test.each table(name, fn)`
         *
         * - `table`: Tagged Template Literal
         * - `name`: String the title of the test, use `$variable` to inject test data into the test title from the tagged template expressions.
         * - `fn`: Function the test to be ran, this is the function that will receive the test data object..
         *
         * @example
         *
         * // API 1
         * test.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])(
         *   '.add(%i, %i)',
         *   (a, b, expected) => {
         *     expect(a + b).toBe(expected);
         *   },
         * );
         *
         * // API 2
         * test.each`
         * a    | b    | expected
         * ${1} | ${1} | ${2}
         * ${1} | ${2} | ${3}
         * ${2} | ${1} | ${3}
         * `('returns $expected when $a is added $b', ({a, b, expected}) => {
         *    expect(a + b).toBe(expected);
         * });
         *
         */
        each: Each;
    }

    interface Describe {
        // tslint:disable-next-line ban-types
        (name: number | string | Function | FunctionLike, fn: EmptyFunction): void;
        /** Only runs the tests inside this `describe` for the current file */
        only: Describe;
        /** Skips running the tests inside this `describe` for the current file */
        skip: Describe;
        each: Each;
    }

    interface MatcherUtils {
        readonly expand: boolean;
        readonly isNot: boolean;
        utils: {
            readonly EXPECTED_COLOR: (text: string) => string;
            readonly RECEIVED_COLOR: (text: string) => string;
            diff: typeof import('jest-diff');
            ensureActualIsNumber(actual: any, matcherName?: string): void;
            ensureExpectedIsNumber(actual: any, matcherName?: string): void;
            ensureNoExpected(actual: any, matcherName?: string): void;
            ensureNumbers(actual: any, expected: any, matcherName?: string): void;
            /**
             * get the type of a value with handling of edge cases like `typeof []` and `typeof null`
             */
            getType(value: any): string;
            matcherHint(matcherName: string, received?: string, expected?: string, options?: { secondArgument?: string, isDirectExpectCall?: boolean }): string;
            pluralize(word: string, count: number): string;
            printExpected(value: any): string;
            printReceived(value: any): string;
            printWithType(name: string, received: any, print: (value: any) => string): string;
            stringify(object: {}, maxDepth?: number): string;
        };
        /**
         *  This is a deep-equality function that will return true if two objects have the same values (recursively).
         */
        equals(a: any, b: any): boolean;
    }

    interface ExpectExtendMap {
        [key: string]: CustomMatcher;
    }

    type CustomMatcher = (this: MatcherUtils, received: any, ...actual: any[]) => CustomMatcherResult | Promise<CustomMatcherResult>;

    interface CustomMatcherResult {
        pass: boolean;
        message: string | (() => string);
    }

    interface SnapshotSerializerOptions {
        callToJSON?: boolean;
        edgeSpacing?: string;
        spacing?: string;
        escapeRegex?: boolean;
        highlight?: boolean;
        indent?: number;
        maxDepth?: number;
        min?: boolean;
        plugins?: SnapshotSerializerPlugin[];
        printFunctionName?: boolean;
        theme?: SnapshotSerializerOptionsTheme;

        // see https://github.com/facebook/jest/blob/e56103cf142d2e87542ddfb6bd892bcee262c0e6/types/PrettyFormat.js
    }
    interface SnapshotSerializerOptionsTheme {
        comment?: string;
        content?: string;
        prop?: string;
        tag?: string;
        value?: string;
    }
    interface SnapshotSerializerColor {
        close: string;
        open: string;
    }
    interface SnapshotSerializerColors {
        comment: SnapshotSerializerColor;
        content: SnapshotSerializerColor;
        prop: SnapshotSerializerColor;
        tag: SnapshotSerializerColor;
        value: SnapshotSerializerColor;
    }
    interface SnapshotSerializerPlugin {
        print(val: any, serialize: ((val: any) => string), indent: ((str: string) => string), opts: SnapshotSerializerOptions, colors: SnapshotSerializerColors): string;
        test(val: any): boolean;
    }

    interface InverseAsymmetricMatchers {
        /**
         * `expect.not.arrayContaining(array)` matches a received array which
         * does not contain all of the elements in the expected array. That is,
         * the expected array is not a subset of the received array. It is the
         * inverse of `expect.arrayContaining`.
         */
        arrayContaining(arr: any[]): any;
        /**
         * `expect.not.objectContaining(object)` matches any received object
         * that does not recursively match the expected properties. That is, the
         * expected object is not a subset of the received object. Therefore,
         * it matches a received object which contains properties that are not
         * in the expected object. It is the inverse of `expect.objectContaining`.
         */
        objectContaining(obj: {}): any;
        /**
         * `expect.not.stringMatching(string | regexp)` matches the received
         * string that does not match the expected regexp. It is the inverse of
         * `expect.stringMatching`.
         */
        stringMatching(str: string | RegExp): any;
        /**
         * `expect.not.stringContaining(string)` matches the received string
         * that does not contain the exact expected string. It is the inverse of
         * `expect.stringContaining`.
         */
        stringContaining(str: string): any;
    }

    /**
     * The `expect` function is used every time you want to test a value.
     * You will rarely call `expect` by itself.
     */
    interface Expect {
        /**
         * The `expect` function is used every time you want to test a value.
         * You will rarely call `expect` by itself.
         *
         * @param actual The value to apply matchers against.
         */
        <T = any>(actual: T): Matchers<T>;
        /**
         * Matches anything but null or undefined. You can use it inside `toEqual` or `toBeCalledWith` instead
         * of a literal value. For example, if you want to check that a mock function is called with a
         * non-null argument:
         *
         * @example
         *
         * test('map calls its argument with a non-null argument', () => {
         *   const mock = jest.fn();
         *   [1].map(x => mock(x));
         *   expect(mock).toBeCalledWith(expect.anything());
         * });
         *
         */
        anything(): any;
        /**
         * Matches anything that was created with the given constructor.
         * You can use it inside `toEqual` or `toBeCalledWith` instead of a literal value.
         *
         * @example
         *
         * function randocall(fn) {
         *   return fn(Math.floor(Math.random() * 6 + 1));
         * }
         *
         * test('randocall calls its callback with a number', () => {
         *   const mock = jest.fn();
         *   randocall(mock);
         *   expect(mock).toBeCalledWith(expect.any(Number));
         * });
         */
        any(classType: any): any;
        /**
         * Matches any array made up entirely of elements in the provided array.
         * You can use it inside `toEqual` or `toBeCalledWith` instead of a literal value.
         */
        arrayContaining(arr: any[]): any;
        /**
         * Verifies that a certain number of assertions are called during a test.
         * This is often useful when testing asynchronous code, in order to
         * make sure that assertions in a callback actually got called.
         */
        assertions(num: number): void;
        /**
         * Verifies that at least one assertion is called during a test.
         * This is often useful when testing asynchronous code, in order to
         * make sure that assertions in a callback actually got called.
         */
        hasAssertions(): void;
        /**
         * You can use `expect.extend` to add your own matchers to Jest.
         */
        extend(obj: ExpectExtendMap): void;
        /**
         * Adds a module to format application-specific data structures for serialization.
         */
        addSnapshotSerializer(serializer: SnapshotSerializerPlugin): void;
        /**
         * Matches any object that recursively matches the provided keys.
         * This is often handy in conjunction with other asymmetric matchers.
         */
        objectContaining(obj: {}): any;
        /**
         * Matches any string that contains the exact provided string
         */
        stringMatching(str: string | RegExp): any;
        /**
         * Matches any received string that contains the exact expected string
         */
        stringContaining(str: string): any;

        not: InverseAsymmetricMatchers;
    }

    interface Matchers<R> {
        /**
         * Ensures the last call to a mock function was provided specific args.
         */
        lastCalledWith(...args: any[]): R;
        /**
         * Ensure that the last call to a mock function has returned a specified value.
         */
        lastReturnedWith(value: any): R;
        /**
         * If you know how to test something, `.not` lets you test its opposite.
         */
        not: Matchers<R>;
        /**
         * Ensure that a mock function is called with specific arguments on an Nth call.
         */
        nthCalledWith(nthCall: number, ...params: any[]): R;
        /**
         * Ensure that the nth call to a mock function has returned a specified value.
         */
        nthReturnedWith(n: number, value: any): R;
        /**
         * Use resolves to unwrap the value of a fulfilled promise so any other
         * matcher can be chained. If the promise is rejected the assertion fails.
         */
        resolves: Matchers<Promise<R>>;
        /**
         * Unwraps the reason of a rejected promise so any other matcher can be chained.
         * If the promise is fulfilled the assertion fails.
         */
        rejects: Matchers<Promise<R>>;
        /**
         * Checks that a value is what you expect. It uses `===` to check strict equality.
         * Don't use `toBe` with floating-point numbers.
         */
        toBe(expected: any): R;
        /**
         * Ensures that a mock function is called.
         */
        toBeCalled(): R;
        /**
         * Ensures that a mock function is called an exact number of times.
         */
        toBeCalledTimes(expected: number): R;
        /**
         * Ensure that a mock function is called with specific arguments.
         */
        toBeCalledWith(...args: any[]): R;
        /**
         * Using exact equality with floating point numbers is a bad idea.
         * Rounding means that intuitive things fail.
         * The default for numDigits is 2.
         */
        toBeCloseTo(expected: number, numDigits?: number): R;
        /**
         * Ensure that a variable is not undefined.
         */
        toBeDefined(): R;
        /**
         * When you don't care what a value is, you just want to
         * ensure a value is false in a boolean context.
         */
        toBeFalsy(): R;
        /**
         * For comparing floating point numbers.
         */
        toBeGreaterThan(expected: number): R;
        /**
         * For comparing floating point numbers.
         */
        toBeGreaterThanOrEqual(expected: number): R;
        /**
         * Ensure that an object is an instance of a class.
         * This matcher uses `instanceof` underneath.
         */
        toBeInstanceOf(expected: any): R;
        /**
         * For comparing floating point numbers.
         */
        toBeLessThan(expected: number): R;
        /**
         * For comparing floating point numbers.
         */
        toBeLessThanOrEqual(expected: number): R;
        /**
         * This is the same as `.toBe(null)` but the error messages are a bit nicer.
         * So use `.toBeNull()` when you want to check that something is null.
         */
        toBeNull(): R;
        /**
         * Use when you don't care what a value is, you just want to ensure a value
         * is true in a boolean context. In JavaScript, there are six falsy values:
         * `false`, `0`, `''`, `null`, `undefined`, and `NaN`. Everything else is truthy.
         */
        toBeTruthy(): R;
        /**
         * Used to check that a variable is undefined.
         */
        toBeUndefined(): R;
        /**
         * Used to check that a variable is NaN.
         */
        toBeNaN(): R;
        /**
         * Used when you want to check that an item is in a list.
         * For testing the items in the list, this uses `===`, a strict equality check.
         */
        toContain(expected: any): R;
        /**
         * Used when you want to check that an item is in a list.
         * For testing the items in the list, this  matcher recursively checks the
         * equality of all fields, rather than checking for object identity.
         */
        toContainEqual(expected: any): R;
        /**
         * Used when you want to check that two objects have the same value.
         * This matcher recursively checks the equality of all fields, rather than checking for object identity.
         */
        toEqual(expected: any): R;
        /**
         * Ensures that a mock function is called.
         */
        toHaveBeenCalled(): R;
        /**
         * Ensures that a mock function is called an exact number of times.
         */
        toHaveBeenCalledTimes(expected: number): R;
        /**
         * Ensure that a mock function is called with specific arguments.
         */
        toHaveBeenCalledWith(...params: any[]): R;
        /**
         * Ensure that a mock function is called with specific arguments on an Nth call.
         */
        toHaveBeenNthCalledWith(nthCall: number, ...params: any[]): R;
        /**
         * If you have a mock function, you can use `.toHaveBeenLastCalledWith`
         * to test what arguments it was last called with.
         */
        toHaveBeenLastCalledWith(...params: any[]): R;
        /**
         * Use to test the specific value that a mock function last returned.
         * If the last call to the mock function threw an error, then this matcher will fail
         * no matter what value you provided as the expected return value.
         */
        toHaveLastReturnedWith(expected: any): R;
        /**
         * Used to check that an object has a `.length` property
         * and it is set to a certain numeric value.
         */
        toHaveLength(expected: number): R;
        /**
         * Use to test the specific value that a mock function returned for the nth call.
         * If the nth call to the mock function threw an error, then this matcher will fail
         * no matter what value you provided as the expected return value.
         */
        toHaveNthReturnedWith(nthCall: number, expected: any): R;
        /**
         * Use to check if property at provided reference keyPath exists for an object.
         * For checking deeply nested properties in an object you may use dot notation or an array containing
         * the keyPath for deep references.
         *
         * Optionally, you can provide a value to check if it's equal to the value present at keyPath
         * on the target object. This matcher uses 'deep equality' (like `toEqual()`) and recursively checks
         * the equality of all fields.
         *
         * @example
         *
         * expect(houseForSale).toHaveProperty('kitchen.area', 20);
         */
        toHaveProperty(propertyPath: string | any[], value?: any): R;
        /**
         * Use to test that the mock function successfully returned (i.e., did not throw an error) at least one time
         */
        toHaveReturned(): R;
        /**
         * Use to ensure that a mock function returned successfully (i.e., did not throw an error) an exact number of times.
         * Any calls to the mock function that throw an error are not counted toward the number of times the function returned.
         */
        toHaveReturnedTimes(expected: number): R;
        /**
         * Use to ensure that a mock function returned a specific value.
         */
        toHaveReturnedWith(expected: any): R;
        /**
         * Check that a string matches a regular expression.
         */
        toMatch(expected: string | RegExp): R;
        /**
         * Used to check that a JavaScript object matches a subset of the properties of an object
         */
        toMatchObject(expected: {} | any[]): R;
        /**
         * This ensures that a value matches the most recent snapshot with property matchers.
         * Check out [the Snapshot Testing guide](http://facebook.github.io/jest/docs/snapshot-testing.html) for more information.
         */
        toMatchSnapshot<T extends {[P in keyof R]: any}>(propertyMatchers: Partial<T>, snapshotName?: string): R;
        /**
         * This ensures that a value matches the most recent snapshot.
         * Check out [the Snapshot Testing guide](http://facebook.github.io/jest/docs/snapshot-testing.html) for more information.
         */
        toMatchSnapshot(snapshotName?: string): R;
        /**
         * This ensures that a value matches the most recent snapshot with property matchers.
         * Instead of writing the snapshot value to a .snap file, it will be written into the source code automatically.
         * Check out [the Snapshot Testing guide](http://facebook.github.io/jest/docs/snapshot-testing.html) for more information.
         */
        toMatchInlineSnapshot<T extends {[P in keyof R]: any}>(propertyMatchers: Partial<T>, snapshot?: string): R;
        /**
         * This ensures that a value matches the most recent snapshot with property matchers.
         * Instead of writing the snapshot value to a .snap file, it will be written into the source code automatically.
         * Check out [the Snapshot Testing guide](http://facebook.github.io/jest/docs/snapshot-testing.html) for more information.
         */
        toMatchInlineSnapshot(snapshot?: string): R;
        /**
         * Ensure that a mock function has returned (as opposed to thrown) at least once.
         */
        toReturn(): R;
        /**
         * Ensure that a mock function has returned (as opposed to thrown) a specified number of times.
         */
        toReturnTimes(count: number): R;
        /**
         * Ensure that a mock function has returned a specified value at least once.
         */
        toReturnWith(value: any): R;
        /**
         * Use to test that objects have the same types as well as structure.
         */
        toStrictEqual(expected: {}): R;
        /**
         * Used to test that a function throws when it is called.
         */
        toThrow(error?: string | Constructable | RegExp | Error): R;
        /**
         * If you want to test that a specific error is thrown inside a function.
         */
        toThrowError(error?: string | Constructable | RegExp | Error): R;
        /**
         * Used to test that a function throws a error matching the most recent snapshot when it is called.
         */
        toThrowErrorMatchingSnapshot(): R;
        /**
         * Used to test that a function throws a error matching the most recent snapshot when it is called.
         * Instead of writing the snapshot value to a .snap file, it will be written into the source code automatically.
         */
        toThrowErrorMatchingInlineSnapshot(snapshot?: string): R;
    }

    interface Constructable {
        new (...args: any[]): any;
    }

    interface Mock<T = any, Y extends any[] = any> extends Function, MockInstance<T, Y> {
        new (...args: Y): T;
        (...args: Y): T;
    }

    interface SpyInstance<T = any, Y extends any[] = any> extends MockInstance<T, Y> {}

    /**
     * Wrap module with mock definitions
     *
     * @example
     *
     *  jest.mock("../api");
     *  import { Api } from "../api";
     *
     *  const myApi: jest.Mocked<Api> = new Api() as any;
     *  myApi.myApiMethod.mockImplementation(() => "test");
     */
    type Mocked<T> = {
        [P in keyof T]: T[P] extends (...args: any[]) => any ? MockInstance<ReturnType<T[P]>, ArgsType<T[P]>>: T[P];
    } & T;

    interface MockInstance<T, Y extends any[]> {
        /** Returns the mock name string set by calling `mockFn.mockName(value)`. */
        getMockName(): string;
        /** Provides access to the mock's metadata */
        mock: MockContext<T, Y>;
        /**
         * Resets all information stored in the mockFn.mock.calls and mockFn.mock.instances arrays.
         *
         * Often this is useful when you want to clean up a mock's usage data between two assertions.
         *
         * Beware that `mockClear` will replace `mockFn.mock`, not just `mockFn.mock.calls` and `mockFn.mock.instances`.
         * You should therefore avoid assigning mockFn.mock to other variables, temporary or not, to make sure you
         * don't access stale data.
         */
        mockClear(): void;
        /**
         * Resets all information stored in the mock, including any initial implementation and mock name given.
         *
         * This is useful when you want to completely restore a mock back to its initial state.
         *
         * Beware that `mockReset` will replace `mockFn.mock`, not just `mockFn.mock.calls` and `mockFn.mock.instances`.
         * You should therefore avoid assigning mockFn.mock to other variables, temporary or not, to make sure you
         * don't access stale data.
         */
        mockReset(): void;
        /**
         * Does everything that `mockFn.mockReset()` does, and also restores the original (non-mocked) implementation.
         *
         * This is useful when you want to mock functions in certain test cases and restore the original implementation in others.
         *
         * Beware that `mockFn.mockRestore` only works when mock was created with `jest.spyOn`. Thus you have to take care of restoration
         * yourself when manually assigning `jest.fn()`.
         *
         * The [`restoreMocks`](https://jestjs.io/docs/en/configuration.html#restoremocks-boolean) configuration option is available
         * to restore mocks automatically between tests.
         */
        mockRestore(): void;
        /**
         * Accepts a function that should be used as the implementation of the mock. The mock itself will still record
         * all calls that go into and instances that come from itself – the only difference is that the implementation
         * will also be executed when the mock is called.
         *
         * Note: `jest.fn(implementation)` is a shorthand for `jest.fn().mockImplementation(implementation)`.
         */
        mockImplementation(fn?: (...args: Y) => T): Mock<T, Y>;
        /**
         * Accepts a function that will be used as an implementation of the mock for one call to the mocked function.
         * Can be chained so that multiple function calls produce different results.
         *
         * @example
         *
         * const myMockFn = jest
         *   .fn()
         *    .mockImplementationOnce(cb => cb(null, true))
         *    .mockImplementationOnce(cb => cb(null, false));
         *
         * myMockFn((err, val) => console.log(val)); // true
         *
         * myMockFn((err, val) => console.log(val)); // false
         */
        mockImplementationOnce(fn: (...args: Y) => T): Mock<T, Y>;
        /** Sets the name of the mock`. */
        mockName(name: string): Mock<T, Y>;
        /**
         * Just a simple sugar function for:
         *
         * @example
         *
         *   jest.fn(function() {
         *     return this;
         *   });
         */
        mockReturnThis(): Mock<T, Y>;
        /**
         * Accepts a value that will be returned whenever the mock function is called.
         *
         * @example
         *
         * const mock = jest.fn();
         * mock.mockReturnValue(42);
         * mock(); // 42
         * mock.mockReturnValue(43);
         * mock(); // 43
         */
        mockReturnValue(value: T): Mock<T, Y>;
        /**
         * Accepts a value that will be returned for one call to the mock function. Can be chained so that
         * successive calls to the mock function return different values. When there are no more
         * `mockReturnValueOnce` values to use, calls will return a value specified by `mockReturnValue`.
         *
         * @example
         *
         * const myMockFn = jest.fn()
         *   .mockReturnValue('default')
         *   .mockReturnValueOnce('first call')
         *   .mockReturnValueOnce('second call');
         *
         * // 'first call', 'second call', 'default', 'default'
         * console.log(myMockFn(), myMockFn(), myMockFn(), myMockFn());
         *
         */
        mockReturnValueOnce(value: T): Mock<T, Y>;
        /**
         * Simple sugar function for: `jest.fn().mockImplementation(() => Promise.resolve(value));`
         */
        mockResolvedValue(value: ResolvedValue<T>): Mock<T, Y>;
        /**
         * Simple sugar function for: `jest.fn().mockImplementationOnce(() => Promise.resolve(value));`
         *
         * @example
         *
         * test('async test', async () => {
         *  const asyncMock = jest
         *    .fn()
         *    .mockResolvedValue('default')
         *    .mockResolvedValueOnce('first call')
         *    .mockResolvedValueOnce('second call');
         *
         *  await asyncMock(); // first call
         *  await asyncMock(); // second call
         *  await asyncMock(); // default
         *  await asyncMock(); // default
         * });
         *
         */
        mockResolvedValueOnce(value: ResolvedValue<T>): Mock<T, Y>;
        /**
         * Simple sugar function for: `jest.fn().mockImplementation(() => Promise.reject(value));`
         *
         * @example
         *
         * test('async test', async () => {
         *   const asyncMock = jest.fn().mockRejectedValue(new Error('Async error'));
         *
         *   await asyncMock(); // throws "Async error"
         * });
         */
        mockRejectedValue(value: RejectedValue<T>): Mock<T, Y>;

        /**
         * Simple sugar function for: `jest.fn().mockImplementationOnce(() => Promise.reject(value));`
         *
         * @example
         *
         * test('async test', async () => {
         *  const asyncMock = jest
         *    .fn()
         *    .mockResolvedValueOnce('first call')
         *    .mockRejectedValueOnce(new Error('Async error'));
         *
         *  await asyncMock(); // first call
         *  await asyncMock(); // throws "Async error"
         * });
         *
         */
        mockRejectedValueOnce(value: RejectedValue<T>): Mock<T, Y>;
    }

    /**
     * Represents the result of a single call to a mock function with a return value.
     */
    interface MockResultReturn<T> {
        type: 'return';
        value: T;
    }
    /**
     * Represents the result of a single incomplete call to a mock function.
     */
    interface MockResultIncomplete {
        type: 'incomplete';
        value: undefined;
    }
    /**
     * Represents the result of a single call to a mock function with a thrown error.
     */
    interface MockResultThrow {
        type: 'throw';
        value: any;
    }

    type MockResult<T> = MockResultReturn<T> | MockResultThrow | MockResultIncomplete;

    interface MockContext<T, Y extends any[]> {
        calls: Y[];
        instances: T[];
        invocationCallOrder: number[];
        /**
         * List of results of calls to the mock function.
         */
        results: Array<MockResult<T>>;
    }
}

// Jest ships with a copy of Jasmine. They monkey-patch its APIs and divergence/deprecation are expected.
// Relevant parts of Jasmine's API are below so they can be changed and removed over time.
// This file can't reference jasmine.d.ts since the globals aren't compatible.

declare function spyOn<T>(object: T, method: keyof T): jasmine.Spy;
/**
 * If you call the function pending anywhere in the spec body,
 * no matter the expectations, the spec will be marked pending.
 */
declare function pending(reason?: string): void;
/**
 * Fails a test when called within one.
 */
declare function fail(error?: any): never;
declare namespace jasmine {
    let DEFAULT_TIMEOUT_INTERVAL: number;
    function clock(): Clock;
    function any(aclass: any): Any;
    function anything(): Any;
    function arrayContaining(sample: any[]): ArrayContaining;
    function objectContaining(sample: any): ObjectContaining;
    function createSpy(name?: string, originalFn?: (...args: any[]) => any): Spy;
    function createSpyObj(baseName: string, methodNames: any[]): any;
    function createSpyObj<T>(baseName: string, methodNames: any[]): T;
    function pp(value: any): string;
    function addCustomEqualityTester(equalityTester: CustomEqualityTester): void;
    function addMatchers(matchers: CustomMatcherFactories): void;
    function stringMatching(value: string | RegExp): Any;

    interface Clock {
        install(): void;
        uninstall(): void;
        /**
         * Calls to any registered callback are triggered when the clock isticked forward
         * via the jasmine.clock().tick function, which takes a number of milliseconds.
         */
        tick(ms: number): void;
        mockDate(date?: Date): void;
    }

    interface Any {
        new (expectedClass: any): any;
        jasmineMatches(other: any): boolean;
        jasmineToString(): string;
    }

    interface ArrayContaining {
        new (sample: any[]): any;
        asymmetricMatch(other: any): boolean;
        jasmineToString(): string;
    }

    interface ObjectContaining {
        new (sample: any): any;
        jasmineMatches(other: any, mismatchKeys: any[], mismatchValues: any[]): boolean;
        jasmineToString(): string;
    }

    interface Spy {
        (...params: any[]): any;
        identity: string;
        and: SpyAnd;
        calls: Calls;
        mostRecentCall: { args: any[]; };
        argsForCall: any[];
        wasCalled: boolean;
    }

    interface SpyAnd {
        /**
         * By chaining the spy with and.callThrough, the spy will still track all
         * calls to it but in addition it will delegate to the actual implementation.
         */
        callThrough(): Spy;
        /**
         * By chaining the spy with and.returnValue, all calls to the function
         * will return a specific value.
         */
        returnValue(val: any): Spy;
        /**
         * By chaining the spy with and.returnValues, all calls to the function
         * will return specific values in order until it reaches the end of the return values list.
         */
        returnValues(...values: any[]): Spy;
        /**
         * By chaining the spy with and.callFake, all calls to the spy
         * will delegate to the supplied function.
         */
        callFake(fn: (...args: any[]) => any): Spy;
        /**
         * By chaining the spy with and.throwError, all calls to the spy
         * will throw the specified value.
         */
        throwError(msg: string): Spy;
        /**
         * When a calling strategy is used for a spy, the original stubbing
         * behavior can be returned at any time with and.stub.
         */
        stub(): Spy;
    }

    interface Calls {
        /**
         * By chaining the spy with calls.any(),
         * will return false if the spy has not been called at all,
         * and then true once at least one call happens.
         */
        any(): boolean;
        /**
         * By chaining the spy with calls.count(),
         * will return the number of times the spy was called
         */
        count(): number;
        /**
         * By chaining the spy with calls.argsFor(),
         * will return the arguments passed to call number index
         */
        argsFor(index: number): any[];
        /**
         * By chaining the spy with calls.allArgs(),
         * will return the arguments to all calls
         */
        allArgs(): any[];
        /**
         * By chaining the spy with calls.all(), will return the
         * context (the this) and arguments passed all calls
         */
        all(): CallInfo[];
        /**
         * By chaining the spy with calls.mostRecent(), will return the
         * context (the this) and arguments for the most recent call
         */
        mostRecent(): CallInfo;
        /**
         * By chaining the spy with calls.first(), will return the
         * context (the this) and arguments for the first call
         */
        first(): CallInfo;
        /**
         * By chaining the spy with calls.reset(), will clears all tracking for a spy
         */
        reset(): void;
    }

    interface CallInfo {
        /**
         * The context (the this) for the call
         */
        object: any;
        /**
         * All arguments passed to the call
         */
        args: any[];
        /**
         * The return value of the call
         */
        returnValue: any;
    }

    interface CustomMatcherFactories {
        [index: string]: CustomMatcherFactory;
    }

    type CustomMatcherFactory = (util: MatchersUtil, customEqualityTesters: CustomEqualityTester[]) => CustomMatcher;

    interface MatchersUtil {
        equals(a: any, b: any, customTesters?: CustomEqualityTester[]): boolean;
        contains<T>(haystack: ArrayLike<T> | string, needle: any, customTesters?: CustomEqualityTester[]): boolean;
        buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: any[]): string;
    }

    type CustomEqualityTester = (first: any, second: any) => boolean;

    interface CustomMatcher {
        compare<T>(actual: T, expected: T, ...args: any[]): CustomMatcherResult;
        compare(actual: any, ...expected: any[]): CustomMatcherResult;
    }

    interface CustomMatcherResult {
        pass: boolean;
        message: string | (() => string);
    }

    interface ArrayLike<T> {
        length: number;
        [n: number]: T;
    }
}

declare namespace jest {
    // types for implementing custom interfaces, from https://github.com/facebook/jest/tree/dd6c5c4/types

    // https://facebook.github.io/jest/docs/en/configuration.html#transform-object-string-string
    // const transformer: Transformer;

    // https://facebook.github.io/jest/docs/en/configuration.html#reporters-array-modulename-modulename-options
    // const reporter: Reporter;

    // https://facebook.github.io/jest/docs/en/configuration.html#testrunner-string
    // const testRunner: TestFramework;

    // https://facebook.github.io/jest/docs/en/configuration.html#testresultsprocessor-string
    // const testResultsProcessor: TestResultsProcessor;

    // leave above declarations for referening type-dependencies
    // .vscode/settings.json: "typescript.referencesCodeLens.enabled": true

    // custom

    // flow's Maybe type https://flow.org/en/docs/types/primitives/#toc-maybe-types
    type Maybe<T> = void | null | undefined | T; // tslint:disable-line:void-return

    type TestResultsProcessor = (testResult: AggregatedResult) => AggregatedResult;

    type HasteResolver = any; // import HasteResolver from 'jest-resolve';
    type ModuleMocker = any; // import { ModuleMocker } from 'jest-mock';
    type ModuleMap = any; // import {ModuleMap} from 'jest-haste-map';
    type HasteFS = any; // import {FS as HasteFS} from 'jest-haste-map';
    type Runtime = any; // import Runtime from 'jest-runtime';
    type Script = any; // import {Script} from 'vm';

    // Config

    type Path = string;
    type Glob = string;

    interface HasteConfig {
        defaultPlatform?: Maybe<string>;
        hasteImplModulePath?: string;
        platforms?: string[];
        providesModuleNodeModules: string[];
    }

    type ReporterConfig = [string, object];

    type ConfigGlobals = object;

    type SnapshotUpdateState = 'all' | 'new' | 'none';

    interface DefaultOptions {
        automock: boolean;
        bail: boolean;
        browser: boolean;
        cache: boolean;
        cacheDirectory: Path;
        changedFilesWithAncestor: boolean;
        clearMocks: boolean;
        collectCoverage: boolean;
        collectCoverageFrom: Maybe<string[]>;
        coverageDirectory: Maybe<string>;
        coveragePathIgnorePatterns: string[];
        coverageReporters: string[];
        coverageThreshold: Maybe<{global: {[key: string]: number}}>;
        errorOnDeprecated: boolean;
        expand: boolean;
        filter: Maybe<Path>;
        forceCoverageMatch: Glob[];
        globals: ConfigGlobals;
        globalSetup: Maybe<string>;
        globalTeardown: Maybe<string>;
        haste: HasteConfig;
        detectLeaks: boolean;
        detectOpenHandles: boolean;
        moduleDirectories: string[];
        moduleFileExtensions: string[];
        moduleNameMapper: {[key: string]: string};
        modulePathIgnorePatterns: string[];
        noStackTrace: boolean;
        notify: boolean;
        notifyMode: string;
        preset: Maybe<string>;
        projects: Maybe<Array<string | ProjectConfig>>;
        resetMocks: boolean;
        resetModules: boolean;
        resolver: Maybe<Path>;
        restoreMocks: boolean;
        rootDir: Maybe<Path>;
        roots: Maybe<Path[]>;
        runner: string;
        runTestsByPath: boolean;
        setupFiles: Path[];
        setupTestFrameworkScriptFile: Maybe<Path>;
        skipFilter: boolean;
        snapshotSerializers: Path[];
        testEnvironment: string;
        testEnvironmentOptions: object;
        testFailureExitCode: string | number;
        testLocationInResults: boolean;
        testMatch: Glob[];
        testPathIgnorePatterns: string[];
        testRegex: string;
        testResultsProcessor: Maybe<string>;
        testRunner: Maybe<string>;
        testURL: string;
        timers: 'real' | 'fake';
        transform: Maybe<{[key: string]: string}>;
        transformIgnorePatterns: Glob[];
        watchPathIgnorePatterns: string[];
        useStderr: boolean;
        verbose: Maybe<boolean>;
        watch: boolean;
        watchman: boolean;
    }

    interface InitialOptions {
        automock?: boolean;
        bail?: boolean;
        browser?: boolean;
        cache?: boolean;
        cacheDirectory?: Path;
        clearMocks?: boolean;
        changedFilesWithAncestor?: boolean;
        changedSince?: string;
        collectCoverage?: boolean;
        collectCoverageFrom?: Glob[];
        collectCoverageOnlyFrom?: {[key: string]: boolean};
        coverageDirectory?: string;
        coveragePathIgnorePatterns?: string[];
        coverageReporters?: string[];
        coverageThreshold?: {global: {[key: string]: number}};
        detectLeaks?: boolean;
        detectOpenHandles?: boolean;
        displayName?: string;
        expand?: boolean;
        filter?: Path;
        findRelatedTests?: boolean;
        forceCoverageMatch?: Glob[];
        forceExit?: boolean;
        json?: boolean;
        globals?: ConfigGlobals;
        globalSetup?: Maybe<string>;
        globalTeardown?: Maybe<string>;
        haste?: HasteConfig;
        reporters?: Array<ReporterConfig | string>;
        logHeapUsage?: boolean;
        lastCommit?: boolean;
        listTests?: boolean;
        mapCoverage?: boolean;
        moduleDirectories?: string[];
        moduleFileExtensions?: string[];
        moduleLoader?: Path;
        moduleNameMapper?: {[key: string]: string};
        modulePathIgnorePatterns?: string[];
        modulePaths?: string[];
        name?: string;
        noStackTrace?: boolean;
        notify?: boolean;
        notifyMode?: string;
        onlyChanged?: boolean;
        outputFile?: Path;
        passWithNoTests?: boolean;
        preprocessorIgnorePatterns?: Glob[];
        preset?: Maybe<string>;
        projects?: Glob[];
        replname?: Maybe<string>;
        resetMocks?: boolean;
        resetModules?: boolean;
        resolver?: Maybe<Path>;
        restoreMocks?: boolean;
        rootDir?: Path;
        roots?: Path[];
        runner?: string;
        runTestsByPath?: boolean;
        scriptPreprocessor?: string;
        setupFiles?: Path[];
        setupTestFrameworkScriptFile?: Path;
        silent?: boolean;
        skipFilter?: boolean;
        skipNodeResolution?: boolean;
        snapshotSerializers?: Path[];
        errorOnDeprecated?: boolean;
        testEnvironment?: string;
        testEnvironmentOptions?: object;
        testFailureExitCode?: string | number;
        testLocationInResults?: boolean;
        testMatch?: Glob[];
        testNamePattern?: string;
        testPathDirs?: Path[];
        testPathIgnorePatterns?: string[];
        testRegex?: string;
        testResultsProcessor?: Maybe<string>;
        testRunner?: string;
        testURL?: string;
        timers?: 'real' | 'fake';
        transform?: {[key: string]: string};
        transformIgnorePatterns?: Glob[];
        watchPathIgnorePatterns?: string[];
        unmockedModulePathPatterns?: string[];
        updateSnapshot?: boolean;
        useStderr?: boolean;
        verbose?: Maybe<boolean>;
        watch?: boolean;
        watchAll?: boolean;
        watchman?: boolean;
        watchPlugins?: string[];
    }

    interface GlobalConfig {
        bail: boolean;
        collectCoverage: boolean;
        collectCoverageFrom: Glob[];
        collectCoverageOnlyFrom: Maybe<{[key: string]: boolean}>;
        coverageDirectory: string;
        coverageReporters: string[];
        coverageThreshold: {global: {[key: string]: number}};
        expand: boolean;
        forceExit: boolean;
        logHeapUsage: boolean;
        mapCoverage: boolean;
        noStackTrace: boolean;
        notify: boolean;
        projects: Glob[];
        replname: Maybe<string>;
        reporters: ReporterConfig[];
        rootDir: Path;
        silent: boolean;
        testNamePattern: string;
        testPathPattern: string;
        testResultsProcessor: Maybe<string>;
        updateSnapshot: SnapshotUpdateState;
        useStderr: boolean;
        verbose: Maybe<boolean>;
        watch: boolean;
        watchman: boolean;
    }

    interface ProjectConfig {
        automock: boolean;
        browser: boolean;
        cache: boolean;
        cacheDirectory: Path;
        clearMocks: boolean;
        coveragePathIgnorePatterns: string[];
        cwd: Path;
        detectLeaks: boolean;
        displayName: Maybe<string>;
        forceCoverageMatch: Glob[];
        globals: ConfigGlobals;
        haste: HasteConfig;
        moduleDirectories: string[];
        moduleFileExtensions: string[];
        moduleLoader: Path;
        moduleNameMapper: Array<[string, string]>;
        modulePathIgnorePatterns: string[];
        modulePaths: string[];
        name: string;
        resetMocks: boolean;
        resetModules: boolean;
        resolver: Maybe<Path>;
        rootDir: Path;
        roots: Path[];
        runner: string;
        setupFiles: Path[];
        setupTestFrameworkScriptFile: Path;
        skipNodeResolution: boolean;
        snapshotSerializers: Path[];
        testEnvironment: string;
        testEnvironmentOptions: object;
        testLocationInResults: boolean;
        testMatch: Glob[];
        testPathIgnorePatterns: string[];
        testRegex: string;
        testRunner: string;
        testURL: string;
        timers: 'real' | 'fake';
        transform: Array<[string, Path]>;
        transformIgnorePatterns: Glob[];
        unmockedModulePathPatterns: Maybe<string[]>;
        watchPathIgnorePatterns: string[];
    }

    // Console

    type LogMessage = string;
    interface LogEntry {
        message: LogMessage;
        origin: string;
        type: LogType;
    }
    type LogType = 'log' | 'info' | 'warn' | 'error';
    type ConsoleBuffer = LogEntry[];

    // Context

    interface Context {
        config: ProjectConfig;
        hasteFS: HasteFS;
        moduleMap: ModuleMap;
        resolver: HasteResolver;
    }

    // Environment

    interface FakeTimers {
        clearAllTimers(): void;
        runAllImmediates(): void;
        runAllTicks(): void;
        runAllTimers(): void;
        runTimersToTime(msToRun: number): void;
        advanceTimersByTime(msToRun: number): void;
        runOnlyPendingTimers(): void;
        runWithRealTimers(callback: any): void;
        useFakeTimers(): void;
        useRealTimers(): void;
    }

    interface $JestEnvironment {
        global: Global;
        fakeTimers: FakeTimers;
        testFilePath: string;
        moduleMocker: ModuleMocker;

        dispose(): void;
        runScript(script: Script): any;
    }

    type Environment = $JestEnvironment;

    // Global

    type Global = object;

    // Reporter

    interface ReporterOnStartOptions {
        estimatedTime: number;
        showStatus: boolean;
    }

    // TestResult

    interface RawFileCoverage {
        path: string;
        s: {[statementId: number]: number};
        b: {[branchId: number]: number};
        f: {[functionId: number]: number};
        l: {[lineId: number]: number};
        fnMap: {[functionId: number]: any};
        statementMap: {[statementId: number]: any};
        branchMap: {[branchId: number]: any};
        inputSourceMap?: object;
    }

    interface RawCoverage {
        [filePath: string]: RawFileCoverage;
    }

    interface FileCoverageTotal {
        total: number;
        covered: number;
        skipped: number;
        pct?: number;
    }

    interface CoverageSummary {
        lines: FileCoverageTotal;
        statements: FileCoverageTotal;
        branches: FileCoverageTotal;
        functions: FileCoverageTotal;
    }

    interface FileCoverage {
        getLineCoverage(): object;
        getUncoveredLines(): number[];
        getBranchCoverageByLine(): object;
        toJSON(): object;
        merge(other: object): void;
        computeSimpleTotals(property: string): FileCoverageTotal;
        computeBranchTotals(): FileCoverageTotal;
        resetHits(): void;
        toSummary(): CoverageSummary;
    }

    interface CoverageMap {
        merge(data: object): void;
        getCoverageSummary(): FileCoverage;
        data: RawCoverage;
        addFileCoverage(fileCoverage: RawFileCoverage): void;
        files(): string[];
        fileCoverageFor(file: string): FileCoverage;
    }

    interface SerializableError {
        code?: any;
        message: string;
        stack: Maybe<string>;
        type?: string;
    }

    type Status = 'passed' | 'failed' | 'skipped' | 'pending';

    type Bytes = number;
    type Milliseconds = number;

    interface AssertionResult {
        ancestorTitles: string[];
        duration?: Maybe<Milliseconds>;
        failureMessages: string[];
        fullName: string;
        numPassingAsserts: number;
        status: Status;
        title: string;
    }

    interface AggregatedResult {
        coverageMap?: Maybe<CoverageMap>;
        numFailedTests: number;
        numFailedTestSuites: number;
        numPassedTests: number;
        numPassedTestSuites: number;
        numPendingTests: number;
        numPendingTestSuites: number;
        numRuntimeErrorTestSuites: number;
        numTodoTests: number;
        numTotalTests: number;
        numTotalTestSuites: number;
        snapshot: SnapshotSummary;
        startTime: number;
        success: boolean;
        testResults: TestResult[];
        wasInterrupted: boolean;
    }

    interface TestResult {
        console: Maybe<ConsoleBuffer>;
        coverage?: RawCoverage;
        memoryUsage?: Bytes;
        failureMessage: Maybe<string>;
        numFailingTests: number;
        numPassingTests: number;
        numPendingTests: number;
        perfStats: {
            end: Milliseconds,
            start: Milliseconds,
        };
        skipped: boolean;
        snapshot: {
            added: number,
            fileDeleted: boolean,
            matched: number,
            unchecked: number,
            unmatched: number,
            updated: number,
        };
        sourceMaps: {[sourcePath: string]: string};
        testExecError?: SerializableError;
        testFilePath: string;
        testResults: AssertionResult[];
    }

    interface SnapshotSummary {
        added: number;
        didUpdate: boolean;
        failure: boolean;
        filesAdded: number;
        filesRemoved: number;
        filesUnmatched: number;
        filesUpdated: number;
        matched: number;
        total: number;
        unchecked: number;
        unmatched: number;
        updated: number;
    }

    // TestRunner

    interface Test {
        context: Context;
        duration?: number;
        path: Path;
    }

    // tslint:disable-next-line:no-empty-interface
    interface Set<T> {} // To allow non-ES6 users the Set below
    interface Reporter {
        onTestResult?(test: Test, testResult: TestResult, aggregatedResult: AggregatedResult): void;
        onRunStart?(results: AggregatedResult, options: ReporterOnStartOptions): void;
        onTestStart?(test: Test): void;
        onRunComplete?(contexts: Set<Context>, results: AggregatedResult): Maybe<Promise<void>>;
        getLastError?(): Maybe<Error>;
    }

    type TestFramework = (
        globalConfig: GlobalConfig,
        config: ProjectConfig,
        environment: Environment,
        runtime: Runtime,
        testPath: string,
    ) => Promise<TestResult>;

    // Transform

    interface TransformedSource {
        code: string;
        map: Maybe<object | string>;
    }

    interface TransformOptions {
        instrument: boolean;
    }

    interface Transformer {
        canInstrument?: boolean;
        createTransformer?(options: any): Transformer;

        getCacheKey?(
            fileData: string,
            filePath: Path,
            configStr: string,
            options: TransformOptions,
        ): string;

        process(
            sourceText: string,
            sourcePath: Path,
            config: ProjectConfig,
            options?: TransformOptions,
        ): string | TransformedSource;
    }
}


text:
package springing;

import java.io.PrintStream;

/**
 * Created by: orangeant, Date: 4/7/16
 */
public class SlayDragonQuest implements Quest {
  private PrintStream stream;

  public SlayDragonQuest(PrintStream stream) {
    this.stream = stream;
  }

  public void embark() {
    stream.println("Embarking on quest to slay the dragon!");
  }
}

redpajama_set_name: RedPajamaGithub


text:
using Kamsar.WebConsole;
using Sitecore.Pipelines;
using Unicorn.Configuration;
using Unicorn.Logging;

namespace Unicorn.Pipelines.UnicornSyncEnd
{
	/// <summary>
	/// Pipeline runs when a whole batch sync configuration finishes sync (e.g. if syncing 4 configs this runs 1 time)
	/// This pipeline runs regardless of any errors in sync. Success is indicated by a flag.
	/// </summary>
	public class UnicornSyncEndPipelineArgs : PipelineArgs
	{
		public UnicornSyncEndPipelineArgs(ILogger logger, bool succeeded, params IConfiguration[] syncedConfigurations)
		{
			Logger = logger;
			SyncedConfigurations = syncedConfigurations;
			Succeeded = succeeded;
		}

		public ILogger Logger { get; }

		public IConfiguration[] SyncedConfigurations { get; }

		public bool Succeeded { get; }
	}
}


text:
/// <reference path="log4javascript.d.ts" />

function aSimpleLoggingMessageString() {
	var log = log4javascript.getDefaultLogger();
	log.info("Hello World");
}

function loggingAnErrorWithAMessage() {
	var log = log4javascript.getDefaultLogger();
	try {
		throw new Error("Faking something going wrong!");
	} catch (e) {
		log.error("An error occurred", e);
	}
}

function loggingMultipleMessagesWithOneLoggingCall() {
	var log = log4javascript.getDefaultLogger();
	var a = "Hello";
	var b = 3;
	log.debug(a, b);
}

function loggingAnObject() {
	var log = log4javascript.getDefaultLogger();
	var obj = { name: "Octopus", tentacles: 8 };
	log.info(obj);
}

function tweakingTheDefaultLogger() {
	var log = log4javascript.getLogger();
	var popUpAppender = new log4javascript.PopUpAppender();
	popUpAppender.setFocusPopUp(true);
	popUpAppender.setNewestMessageAtTop(true);
	log.addAppender(popUpAppender);
	log.debug("Hello world!");
}

function sendingLogMessagesToTheServer() {
	var log = log4javascript.getLogger("mylogger");
	var url = "???";
	var ajaxAppender = new log4javascript.AjaxAppender(url);
	log.addAppender(ajaxAppender);
}

function changingTheFormatOfLogMessages() {
	var popUpAppender = new log4javascript.PopUpAppender();
	var layout = new log4javascript.PatternLayout("[%-5p] %m");
	popUpAppender.setLayout(layout);
}


text:
{% extends "!layout.html" %}
{%- set script_files = script_files + ["_static/cookies.js",
                                       "_static/language.js",
                                       "_static/pace.min.js",
                                       "_static/webgl.js"] %}
{% block extrahead %}
    <link rel="shortcut icon" href="{{ pathto('_static/itk_favicon.ico', 1) }}" />
    <link rel="stylesheet" href="{{ pathto('_static/pace.css', 1) }}" />
{% endblock %}

{% block body %}

Note

WebGL supported was not detected in your browser.

You should really be more careful.

{% endblock %}

{% block footer %}

      Documentation and code by the

        Insight Software Consortium

      is licensed under a

      Creative Commons Attribution 3.0 Unported License
      and Apache 2.0
        License, respectively.

      Last updated on {{ last_updated|e }}.

      Created using Sphinx {{
      sphinx_version|e }},
      and CMake.

{% endblock %}


text:
# Pikachu Volleyball

This is a hommage game.
Each player plays his pikachu for beach volleyball!
I've made this recalling PikachuVolleyball I played.

[![Play video](https://img.youtube.com/vi/O36MuI4PVRI/0.jpg)](https://www.youtube.com/watch?v=O36MuI4PVRI)


text:
//  See library home page at http://www.boost.org/libs/numeric/conversion
//
// Contact the author at: fernando_cacciola@hotmail.com
//
//
//  Revision History
//
//    19 Nov 2001 Syntatic changes as suggested by Darin Adler (Fernando Cacciola)
//    08 Nov 2001 Fixes to accommodate MSVC (Fernando Cacciola)
//    04 Nov 2001 Fixes to accommodate gcc2.92 (Fernando Cacciola)
//    30 Oct 2001 Some fixes suggested by Daryle Walker (Fernando Cacciola)
//    25 Oct 2001 Initial boostification (Fernando Cacciola)
//    23 Jan 2004 Inital add to cvs (post review)s
//    22 Jun 2011 Added support for specializing cast policies via numeric_cast_traits (Brandon Kohn).
//
#ifndef BOOST_NUMERIC_CONVERSION_CAST_25OCT2001_HPP
#define BOOST_NUMERIC_CONVERSION_CAST_25OCT2001_HPP

#include <boost/detail/workaround.hpp>

#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))

#  include<boost/numeric/conversion/detail/old_numeric_cast.hpp>

#else

#include <boost/type.hpp>
#include <boost/numeric/conversion/converter.hpp>
#include <boost/numeric/conversion/numeric_cast_traits.hpp>

namespace boost
{
    template <typename Target, typename Source>
    inline Target numeric_cast( Source arg )
    {
        typedef numeric::conversion_traits<Target, Source>   conv_traits;
        typedef numeric::numeric_cast_traits<Target, Source> cast_traits;
        typedef boost::numeric::converter
            <
                Target,
                Source,
                conv_traits,
                typename cast_traits::overflow_policy,
                typename cast_traits::rounding_policy,
                boost::numeric::raw_converter< conv_traits >,
                typename cast_traits::range_checking_policy
            > converter;
        return converter::convert(arg);
    }

    using numeric::bad_numeric_cast;
} // namespace boost

#endif

#endif


text:
package org.apach3.http.impl.nio.reactor;

import java.io.IOException;
import java.net.SocketAddress;
import java.nio.channels.Channel;
import java.nio.channels.SelectionKey;

import org.apach3.http.annotation.ThreadSafe;
import org.apach3.http.nio.reactor.IOSession;
import org.apach3.http.nio.reactor.SessionRequest;
import org.apach3.http.nio.reactor.SessionRequestCallback;

/**
 * Default implementation of {@link SessionRequest}.
 *
 * @since 4.0
 */
@ThreadSafe
public class SessionRequestImpl implements SessionRequest {

    private volatile boolean completed;
    private volatile SelectionKey key;

    private final SocketAddress remoteAddress;
    private final SocketAddress localAddress;
    private final Object attachment;
    private final SessionRequestCallback callback;

    private volatile int connectTimeout;
    private volatile IOSession session = null;
    private volatile IOException exception = null;

    public SessionRequestImpl(
            final SocketAddress remoteAddress,
            final SocketAddress localAddress,
            final Object attachment,
            final SessionRequestCallback callback) {
        super();
        if (remoteAddress == null) {
            throw new IllegalArgumentException("Remote address may not be null");
        }
        this.remoteAddress = remoteAddress;
        this.localAddress = localAddress;
        this.attachment = attachment;
        this.callback = callback;
        this.connectTimeout = 0;
    }

    public SocketAddress getRemoteAddress() {
        return this.remoteAddress;
    }

    public SocketAddress getLocalAddress() {
        return this.localAddress;
    }

    public Object getAttachment() {
        return this.attachment;
    }

    public boolean isCompleted() {
        return this.completed;
    }

    protected void setKey(final SelectionKey key) {
        this.key = key;
    }

    public void waitFor() throws InterruptedException {
        if (this.completed) {
            return;
        }
        synchronized (this) {
            while (!this.completed) {
                wait();
            }
        }
    }

    public IOSession getSession() {
        synchronized (this) {
            return this.session;
        }
    }

    public IOException getException() {
        synchronized (this) {
            return this.exception;
        }
    }

    public void completed(final IOSession session) {
        if (session == null) {
            throw new IllegalArgumentException("Session may not be null");
        }
        if (this.completed) {
            return;
        }
        this.completed = true;
        synchronized (this) {
            this.session = session;
            if (this.callback != null) {
                this.callback.completed(this);
            }
            notifyAll();
        }
    }

    public void failed(final IOException exception) {
        if (exception == null) {
            return;
        }
        if (this.completed) {
            return;
        }
        this.completed = true;
        SelectionKey key = this.key;
        if (key != null) {
            key.cancel();
            Channel channel = key.channel();
            if (channel.isOpen()) {
                try {
                    channel.close();
                } catch (IOException ignore) {}
            }
        }
        synchronized (this) {
            this.exception = exception;
            if (this.callback != null) {
                this.callback.failed(this);
            }
            notifyAll();
        }
    }

    public void timeout() {
        if (this.completed) {
            return;
        }
        this.completed = true;
        SelectionKey key = this.key;
        if (key != null) {
            key.cancel();
            Channel channel = key.channel();
            if (channel.isOpen()) {
                try {
                    channel.close();
                } catch (IOException ignore) {}
            }
        }
        synchronized (this) {
            if (this.callback != null) {
                this.callback.timeout(this);
            }
        }
    }

    public int getConnectTimeout() {
        return this.connectTimeout;
    }

    public void setConnectTimeout(int timeout) {
        if (this.connectTimeout != timeout) {
            this.connectTimeout = timeout;
            SelectionKey key = this.key;
            if (key != null) {
                key.selector().wakeup();
            }
        }
    }

    public void cancel() {
        if (this.completed) {
            return;
        }
        this.completed = true;
        SelectionKey key = this.key;
        if (key != null) {
            key.cancel();
            Channel channel = key.channel();
            if (channel.isOpen()) {
                try {
                    channel.close();
                } catch (IOException ignore) {}
            }
        }
        synchronized (this) {
            if (this.callback != null) {
                this.callback.cancelled(this);
            }
            notifyAll();
        }
    }

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media;

namespace Anony.Primitives
{
    public enum Theme
    {
        Light,
        Dark,
        Custom
    }

    public static class ThemeManager
    {
        /// <summary>
        /// 白
        /// </summary>
        public static void DarkTheme()
        {
            SetColor("AcBackground", Color.FromArgb(255, 234, 234, 234));
            SetColor("AcHomeBorder", Color.FromArgb(255, 255, 255, 255));
            SetColor("AcTitle", Color.FromArgb(255, 96, 96, 96));
            SetColor("AcContent", Color.FromArgb(255, 64, 64, 64));
            SetColor("AcPoBackground", Color.FromArgb(255, 214, 214, 214));
            SetColor("AcReplyBackground", Color.FromArgb(255, 154, 191, 232));
        }

        private static void SetColor(string name, Color color)
        {
            ((SolidColorBrush)Application.Current.Resources[name]).Color = color;

        }
        /// <summary>
        /// 黑
        /// </summary>
        public static void LightTheme()
        {
            SetColor("AcBackground", Color.FromArgb(255, 16, 16, 16));
            SetColor("AcHomeBorder", Color.FromArgb(255, 21, 21, 21));
            SetColor("AcTitle", Color.FromArgb(255, 144, 144, 144));
            SetColor("AcContent", Color.FromArgb(255, 160, 160, 160));
            SetColor("AcPoBackground", Color.FromArgb(255, 81, 77, 87));
            SetColor("AcReplyBackground", Color.FromArgb(255, 48, 66, 85));
        }
        /// <summary>
        /// 用户
        /// </summary>
        public static void CustomTheme()
        {
            ThemeInfo.ChangedTheme();
        }
    }
}


text:
.. _west-extensions:

Extensions
##########

West is "pluggable": you can add your own commands to west without editing its
source code. These are called **west extension commands**, or just "extensions"
for short. Extensions show up in the ``west --help`` output in a special
section for the project which defines them. This page provides general
information on west extension commands, and has a tutorial for writing your
own.

Some commands you can run when using west with Zephyr, like the ones used to
:ref:`build, flash, and debug <west-build-flash-debug>` and the
:ref:`ones described here <west-zephyr-ext-cmds>` , are extensions. That's why
help for them shows up like this in ``west --help``:

.. code-block:: none

   commands from project at "zephyr":
     completion:           display shell completion scripts
     boards:               display information about supported boards
     build:                compile a Zephyr application
     sign:                 sign a Zephyr binary for bootloader chain-loading
     flash:                flash and run a binary on a board
     debug:                flash and interactively debug a Zephyr application
     debugserver:          connect to board and launch a debug server
     attach:               interactively debug a board

See :file:`zephyr/scripts/west-commands.yml` and the
:file:`zephyr/scripts/west_commands` directory for the implementation details.

Disabling Extension Commands
****************************

To disable support for extension commands, set the ``commands.allow_extensions``
:ref:`configuration <west-config>` option to ``false``. To set this
globally for whenever you run west, use:

.. code-block:: console

   west config --global commands.allow_extensions false

If you want to, you can then re-enable them in a particular :term:`west
workspace` with:

.. code-block:: console

   west config --local commands.allow_extensions true

Note that the files containing extension commands are not imported by west
unless the commands are explicitly run. See below for details.

Adding a West Extension
***********************

There are three steps to adding your own extension:

#. Write the code implementing the command.
#. Add information about it to a :file:`west-commands.yml` file.
#. Make sure the :file:`west-commands.yml` file is referenced in the
   :term:`west manifest`.

Note that west ignores extension commands whose names are the same as a
built-in command.

Step 1: Implement Your Command
==============================

Create a Python file to contain your command implementation (see the "Meta >
Requires" information on the `west PyPI page`_ for details on the currently
supported versions of Python). You can put it in anywhere in any project
tracked by your :term:`west manifest`, or the manifest repository itself.
This file must contain a subclass of the ``west.commands.WestCommand`` class;
this class will be instantiated and used when your extension is run.

Here is a basic skeleton you can use to get started. It contains a subclass of
``WestCommand``, with implementations for all the abstract methods. For more
details on the west APIs you can use, see :ref:`west-apis`.

.. code-block:: py

   '''my_west_extension.py

   Basic example of a west extension.'''

   from textwrap import dedent            # just for nicer code indentation

   from west.commands import WestCommand  # your extension must subclass this
   from west import log                   # use this for user output

   class MyCommand(WestCommand):

       def __init__(self):
           super().__init__(
               'my-command-name',  # gets stored as self.name
               'one-line help for what my-command-name does',  # self.help
               # self.description:
               dedent('''
               A multi-line description of my-command.

               You can split this up into multiple paragraphs and they'll get
               reflowed for you. You can also pass
               formatter_class=argparse.RawDescriptionHelpFormatter when calling
               parser_adder.add_parser() below if you want to keep your line
               endings.'''))

       def do_add_parser(self, parser_adder):
           # This is a bit of boilerplate, which allows you full control over the
           # type of argparse handling you want. The "parser_adder" argument is
           # the return value of an argparse.ArgumentParser.add_subparsers() call.
           parser = parser_adder.add_parser(self.name,
                                            help=self.help,
                                            description=self.description)

           # Add some example options using the standard argparse module API.
           parser.add_argument('-o', '--optional', help='an optional argument')
           parser.add_argument('required', help='a required argument')

           return parser           # gets stored as self.parser

       def do_run(self, args, unknown_args):
           # This gets called when the user runs the command, e.g.:
           #
           #   $ west my-command-name -o FOO BAR
           #   --optional is FOO
           #   required is BAR
           log.inf('--optional is', args.optional)
           log.inf('required is', args.required)

You can ignore the second argument to ``do_run()`` (``unknown_args`` above), as
``WestCommand`` will reject unknown arguments by default. If you want to be
passed a list of unknown arguments instead, add ``accepts_unknown_args=True``
to the ``super().__init__()`` arguments.

Step 2: Add or Update Your :file:`west-commands.yml`
====================================================

You now need to add a :file:`west-commands.yml` file to your project which
describes your extension to west.

Here is an example for the above class definition, assuming it's in
:file:`my_west_extension.py` at the project root directory:

.. code-block:: yaml

   west-commands:
     - file: my_west_extension.py
       commands:
         - name: my-command-name
           class: MyCommand
           help: one-line help for what my-command-name does

The top level of this YAML file is a map with a ``west-commands`` key.  The
key's value is a sequence of "command descriptors".  Each command descriptor
gives the location of a file implementing west extensions, along with the names
of those extensions, and optionally the names of the classes which define them
(if not given, the ``class`` value defaults to the same thing as ``name``).

Some information in this file is redundant with definitions in the Python code.
This is because west won't import :file:`my_west_extension.py` until the user
runs ``west my-command-name``, since:

- It allows users to run ``west update`` with a manifest from an untrusted
  source, then use other west commands without your code being imported along
  the way. Since importing a Python module is shell-equivalent, this provides
  some peace of mind.

- It's a small optimization, since your code will only be imported if it is
  needed.

So, unless your command is explicitly run, west will just load the
:file:`west-commands.yml` file to get the basic information it needs to display
information about your extension to the user in ``west --help`` output, etc.

If you have multiple extensions, or want to split your extensions across
multiple files, your :file:`west-commands.yml` will look something like this:

.. code-block:: yaml

   west-commands:
     - file: my_west_extension.py
       commands:
         - name: my-command-name
           class: MyCommand
           help: one-line help for what my-command-name does
     - file: another_file.py
       commands:
         - name: command2
           help: another cool west extension
         - name: a-third-command
           class: ThirdCommand
           help: a third command in the same file as command2

Above:

- :file:`my_west_extension.py` defines extension ``my-command-name``
  with class ``MyCommand``
- :file:`another_file.py` defines two extensions:

  #. ``command2`` with class ``command2``
  #. ``a-third-command`` with class ``ThirdCommand``

See the file :file:`west-commands-schema.yml` in the `west repository`_ for a
schema describing the contents of a :file:`west-comands.yml`.

Step 3: Update Your Manifest
============================

Finally, you need to specify the location of the :file:`west-commands.yml` you
just edited in your west manifest. If your extension is in a project, add it
like this:

.. code-block:: yaml

   manifest:
      # [... other contents ...]

      projects:
        - name: your-project
          west-commands: path/to/west-commands.yml
        # [... other projects ...]

Where :file:`path/to/west-commands.yml` is relative to the root of the project.
Note that the name :file:`west-commands.yml`, while encouraged, is just a
convention; you can name the file something else if you need to.

Alternatively, if your extension is in the manifest repository, just do the
same thing in the manifest's ``self`` section, like this:

.. code-block:: yaml

   manifest:
     # [... other contents ...]

     self:
       west-commands: path/to/west-commands.yml

That's it; you can now run ``west my-command-name``. Your command's name, help,
and the project which contains its code will now also show up in the ``west
--help`` output.  If you share the updated repositories with others, they'll be
able to use it, too.

.. _west PyPI page:
   https://pypi.org/project/west/

.. _west repository:
   https://github.com/zephyrproject-rtos/west/


text:
AdBase::Application.routes.draw do

  devise_for :users, :path => '', :path_names => {:sign_in => '/login', :sign_up => 'users/new', :sign_out => '/logout'}

  resources :users
  match 'profile' => 'users#profile', :path => :profile

  resources :ads
  resources :sites
  resources :zones

  match 'dashboard' => 'dashboard#index'
  match '/out/:id' => 'connect#out'
  match '/connect/:ids.js' => 'connect#index'

  root :to => "home#index"

  # The priority is based upon order of creation:
  # first created -> highest priority.

  # Sample of regular route:
  #   match 'products/:id' => 'catalog#view'
  # Keep in mind you can assign values other than :controller and :action

  # Sample of named route:
  #   match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
  # This route can be invoked with purchase_url(:id => product.id)

  # Sample resource route (maps HTTP verbs to controller actions automatically):
  #   resources :products

  # Sample resource route with options:
  #   resources :products do
  #     member do
  #       get 'short'
  #       post 'toggle'
  #     end
  #
  #     collection do
  #       get 'sold'
  #     end
  #   end

  # Sample resource route with sub-resources:
  #   resources :products do
  #     resources :comments, :sales
  #     resource :seller
  #   end

  # Sample resource route with more complex sub-resources
  #   resources :products do
  #     resources :comments
  #     resources :sales do
  #       get 'recent', :on => :collection
  #     end
  #   end

  # Sample resource route within a namespace:
  #   namespace :admin do
  #     # Directs /admin/products/* to Admin::ProductsController
  #     # (app/controllers/admin/products_controller.rb)
  #     resources :products
  #   end

  # See how all your routes lay out with "rake routes"

  # This is a legacy wild controller route that's not recommended for RESTful applications.
  # Note: This route will make all actions in every controller accessible via GET requests.
  # match ':controller(/:action(/:id(.:format)))'
end