nextjs ( extra ?: ExtraConfigs , ) : Promise < { 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 ?: "babel" | "v8" ; coverageReporters ?: (
| "json" | "clover" | "cobertura" | "html-spa" | "html" | "json-summary" | "lcov" | "lcovonly" | "none" | "teamcity" | "text" | "text-lcov" | "text-summary" | [ | "json" | "clover" | "cobertura" | "html-spa" | "html" | "json-summary" | "lcov" | "lcovonly" | "none" | "teamcity" | "text" | "text-lcov" | "text-summary" , { [ key : string ]: unknown } , ] )
[] ; coverageThreshold ?: { global : { branches ?: number ; functions ?: number ; lines ?: number ; statements ?: number ; } ; [ path : string ]: { branches ?: number ; functions ?: number ; lines ?: number ; statements ?: number ; } ; } ; dependencyExtractor ?: string ; detectLeaks ?: boolean ; detectOpenHandles ?: boolean ; displayName ?: | string | { color : | "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright" ; name : string ; } ; errorOnDeprecated ?: boolean ; expand ?: boolean ; extensionsToTreatAsEsm ?: string [] ; fakeTimers ?: { enableGlobally?: boolean; } & ({ advanceTimers?: number | boolean; doNotFake?: ("Date" | "hrtime" | "nextTick" | "performance" | "queueMicrotask" | "requestAnimationFrame" | "cancelAnimationFrame" | ... 7 more ... | "clearTimeout")[]; now?: number; timerLimit?: number; legacyFakeTimers?: false; } | { ...; })
; filter ?: string ; findRelatedTests ?: boolean ; forceCoverageMatch ?: string [] ; forceExit ?: boolean ; globals ?: { [ key : string ]: unknown } ; globalSetup ?: null | string ; globalTeardown ?: null | string ; haste ?: { computeSha1 ?: boolean ; defaultPlatform ?: null | string ; enableSymlinks ?: boolean ; forceNodeFilesystemAPI ?: boolean ; hasteImplModulePath ?: string ; hasteMapModulePath ?: string ; platforms ?: string [] ; retainAllFiles ?: boolean ; throwOnModuleCollision ?: boolean ; } ; 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 ?: null | string ; prettierPath ?: null | string ; projects ?: (
string | { [ key : string ]: unknown } )
[] ; randomize ?: boolean ; replname ?: null | string ; reporters ?: (
string | [ string , { [ key : string ]: unknown } ] )
[] ; resetMocks ?: boolean ; resetModules ?: boolean ; resolver ?: null | string ; restoreMocks ?: boolean ; rootDir ?: string ; roots ?: string [] ; runner ?: string ; runTestsByPath ?: boolean ; 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 ?: { [ key : string ]: unknown } ; testFailureExitCode ?: number ; testLocationInResults ?: boolean ; testMatch ?: string [] ; testNamePattern ?: string ; testPathIgnorePatterns ?: string [] ; testRegex ?: string | string [] ; testResultsProcessor ?: string ; testRunner ?: string ; testSequencer ?: string ; testTimeout ?: number ; transform ?: { [ key : string ]: string | [ string , unknown ] } ; transformIgnorePatterns ?: string [] ; unmockedModulePathPatterns ?: string [] ; updateSnapshot ?: boolean ; useStderr ?: boolean ; verbose ?: boolean ; waitForUnhandledRejections ?: boolean ; watch ?: boolean ; watchAll ?: boolean ; watchman ?: boolean ; watchPathIgnorePatterns ?: string [] ; watchPlugins ?: (
string | [ string , unknown ] )
[] ; workerIdleMemoryLimit ?: string | number ; workerThreads ?: boolean ; } , >
This configuration adds to the base config by wrapping the unit test project by calling
next/jest. It also adds thejest-environment-jsdomtest environment, and sets up@testing-library/jest-dom.