• This configuration adds to the base config by wrapping the unit test project by calling next/jest. It also adds the jest-environment-jsdom test environment, and sets up @testing-library/jest-dom.

    Parameters

    • extra: ExtraConfigs = {}

      extensions and wrappers for the projects and global jest config

    Returns Promise<Partial<{
        automock: boolean;
        bail: number | boolean;
        cache: boolean;
        cacheDirectory: string;
        changedFilesWithAncestor: boolean;
        changedSince: string;
        ci: boolean;
        clearMocks: boolean;
        collectCoverage: boolean;
        collectCoverageFrom: string[];
        coverageDirectory: string;
        coveragePathIgnorePatterns: string[];
        coverageProvider: CoverageProvider;
        coverageReporters: CoverageReporters;
        coverageThreshold: CoverageThreshold;
        dependencyExtractor: string;
        detectLeaks: boolean;
        detectOpenHandles: boolean;
        displayName: string | DisplayName;
        errorOnDeprecated: boolean;
        expand: boolean;
        extensionsToTreatAsEsm: string[];
        fakeTimers: FakeTimers;
        filter: string;
        findRelatedTests: boolean;
        forceCoverageMatch: string[];
        forceExit: boolean;
        globalSetup: undefined | null | string;
        globalTeardown: undefined | null | string;
        globals: ConfigGlobals;
        haste: HasteConfig;
        id: string;
        injectGlobals: boolean;
        json: boolean;
        lastCommit: boolean;
        listTests: boolean;
        logHeapUsage: boolean;
        maxConcurrency: number;
        maxWorkers: string | number;
        moduleDirectories: string[];
        moduleFileExtensions: string[];
        moduleNameMapper: {
            [key: string]: string | string[];
        };
        modulePathIgnorePatterns: string[];
        modulePaths: string[];
        noStackTrace: boolean;
        notify: boolean;
        notifyMode: string;
        onlyChanged: boolean;
        onlyFailures: boolean;
        openHandlesTimeout: number;
        outputFile: string;
        passWithNoTests: boolean;
        preset: undefined | null | string;
        prettierPath: undefined | null | string;
        projects: (string | InitialProjectOptions)[];
        randomize: boolean;
        replname: undefined | null | string;
        reporters: (string | ReporterConfig)[];
        resetMocks: boolean;
        resetModules: boolean;
        resolver: undefined | null | string;
        restoreMocks: boolean;
        rootDir: string;
        roots: string[];
        runTestsByPath: boolean;
        runner: string;
        runtime: string;
        sandboxInjectedGlobals: string[];
        setupFiles: string[];
        setupFilesAfterEnv: string[];
        showSeed: boolean;
        silent: boolean;
        skipFilter: boolean;
        skipNodeResolution: boolean;
        slowTestThreshold: number;
        snapshotFormat: {
            callToJSON?: boolean;
            compareKeys?: null;
            escapeRegex?: boolean;
            escapeString?: boolean;
            highlight?: boolean;
            indent?: number;
            maxDepth?: number;
            maxWidth?: number;
            min?: boolean;
            printBasicPrototype?: boolean;
            printFunctionName?: boolean;
            theme?: {
                comment?: string;
                content?: string;
                prop?: string;
                tag?: string;
                value?: string;
            };
        };
        snapshotResolver: string;
        snapshotSerializers: string[];
        testEnvironment: string;
        testEnvironmentOptions: Record<string, unknown>;
        testFailureExitCode: string | number;
        testLocationInResults: boolean;
        testMatch: string[];
        testNamePattern: string;
        testPathIgnorePatterns: string[];
        testRegex: string | string[];
        testResultsProcessor: string;
        testRunner: string;
        testSequencer: string;
        testTimeout: number;
        transform: {
            [regex: string]: string | TransformerConfig;
        };
        transformIgnorePatterns: string[];
        unmockedModulePathPatterns: string[];
        updateSnapshot: boolean;
        useStderr: boolean;
        verbose?: boolean;
        watch: boolean;
        watchAll: boolean;
        watchPathIgnorePatterns: string[];
        watchPlugins: (string | [string, Record<string, unknown>])[];
        watchman: boolean;
        workerIdleMemoryLimit: string | number;
        workerThreads: boolean;
    }>>

    the jest config

    Example

    // jest.config.js
    export { nextjs as default } from "@cprussin/jest-config";

    Example

    // jest.config.js
    import { nextjs } from "@cprussin/jest-config";
    export default nextjs({
    global: {
    config: {
    passWithnoTests: true
    }
    }
    })

Generated using TypeDoc