Interface JestConfigOptions
-
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
JestConfigOptions.Jsii$Proxy
@Generated(value="jsii-pacmak/1.96.0 (build 921e240)", date="2024-03-28T21:16:43.166Z") @Stability(Experimental) public interface JestConfigOptions extends software.amazon.jsii.JsiiSerializable
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classJestConfigOptions.BuilderA builder forJestConfigOptionsstatic classJestConfigOptions.Jsii$ProxyAn implementation forJestConfigOptions
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description static JestConfigOptions.Builderbuilder()default Map<String,Object>getAdditionalOptions()(experimental) Escape hatch to allow any value.default BooleangetAutomock()(experimental) This option tells Jest that all imported modules in your tests should be mocked automatically.default ObjectgetBail()(experimental) By default, Jest runs all tests and produces all errors into the console upon completion.default StringgetCacheDirectory()(experimental) The directory where Jest should store its cached dependency information.default BooleangetClearMocks()(experimental) Automatically clear mock calls and instances before every test.default BooleangetCollectCoverage()(experimental) Indicates whether the coverage information should be collected while executing the test.default List<String>getCollectCoverageFrom()(experimental) An array of glob patterns indicating a set of files for which coverage information should be collected.default StringgetCoverageDirectory()(experimental) The directory where Jest should output its coverage files.default List<String>getCoveragePathIgnorePatterns()(experimental) An array of regexp pattern strings that are matched against all file paths before executing the test.default StringgetCoverageProvider()(experimental) Indicates which provider should be used to instrument code for coverage.default List<String>getCoverageReporters()(experimental) A list of reporter names that Jest uses when writing coverage reports.default CoverageThresholdgetCoverageThreshold()(experimental) Specify the global coverage thresholds.default StringgetDependencyExtractor()(experimental) This option allows the use of a custom dependency extractor.default ObjectgetDisplayName()(experimental) Allows for a label to be printed alongside a test while it is running.default BooleangetErrorOnDeprecated()(experimental) Make calling deprecated APIs throw helpful error messages.default List<String>getExtraGlobals()(experimental) Test files run inside a vm, which slows calls to global context properties (e.g.default List<String>getForceCoverageMatch()(experimental) Test files are normally ignored from collecting code coverage.default ObjectgetGlobals()(experimental) A set of global variables that need to be available in all test environments.default StringgetGlobalSetup()(experimental) This option allows the use of a custom global setup module which exports an async function that is triggered once before all test suites.default StringgetGlobalTeardown()(experimental) This option allows the use of a custom global teardown module which exports an async function that is triggered once after all test suites.default HasteConfiggetHaste()(experimental) This will be used to configure the behavior of jest-haste-map, Jest's internal file crawler/cache system.default BooleangetInjectGlobals()(experimental) Insert Jest's globals (expect, test, describe, beforeEach etc.) into the global environment.default NumbergetMaxConcurrency()(experimental) A number limiting the number of tests that are allowed to run at the same time when using test.concurrent.default ObjectgetMaxWorkers()(experimental) Specifies the maximum number of workers the worker-pool will spawn for running tests.default List<String>getModuleDirectories()(experimental) An array of directory names to be searched recursively up from the requiring module's location.default List<String>getModuleFileExtensions()(experimental) An array of file extensions your modules use.default Map<String,Object>getModuleNameMapper()(experimental) A map from regular expressions to module names or to arrays of module names that allow to stub out resources, like images or styles with a single module.default List<String>getModulePathIgnorePatterns()(experimental) An array of regexp pattern strings that are matched against all module paths before those paths are to be considered 'visible' to the module loader.default List<String>getModulePaths()(experimental) An alternative API to setting the NODE_PATH env variable, modulePaths is an array of absolute paths to additional locations to search when resolving modules.default BooleangetNotify()(experimental) Activates notifications for test results.default StringgetNotifyMode()(experimental) Specifies notification mode.default StringgetPreset()(experimental) A preset that is used as a base for Jest's configuration.default StringgetPrettierPath()(experimental) Sets the path to the prettier node module used to update inline snapshots.default List<Object>getProjects()(experimental) When the projects configuration is provided with an array of paths or glob patterns, Jest will run tests in all of the specified projects at the same time.default List<JestReporter>getReporters()(experimental) Use this configuration option to add custom reporters to Jest.default BooleangetResetMocks()(experimental) Automatically reset mock state before every test.default BooleangetResetModules()(experimental) By default, each test file gets its own independent module registry.default StringgetResolver()(experimental) This option allows the use of a custom resolver.default BooleangetRestoreMocks()(experimental) Automatically restore mock state before every test.default StringgetRootDir()(experimental) The root directory that Jest should scan for tests and modules within.default List<String>getRoots()(experimental) A list of paths to directories that Jest should use to search for files in.default StringgetRunner()(experimental) This option allows you to use a custom runner instead of Jest's default test runner.default List<String>getSetupFiles()(experimental) A list of paths to modules that run some code to configure or set up the testing environment.default List<String>getSetupFilesAfterEnv()(experimental) A list of paths to modules that run some code to configure or set up the testing framework before each test file in the suite is executed.default NumbergetSlowTestThreshold()(experimental) The number of seconds after which a test is considered as slow and reported as such in the results.default StringgetSnapshotResolver()(experimental) The path to a module that can resolve test<->snapshot path.default List<String>getSnapshotSerializers()(experimental) A list of paths to snapshot serializer modules Jest should use for snapshot testing.default StringgetTestEnvironment()(experimental) The test environment that will be used for testing.default ObjectgetTestEnvironmentOptions()(experimental) Test environment options that will be passed to the testEnvironment.default NumbergetTestFailureExitCode()(experimental) The exit code Jest returns on test failure.default List<String>getTestMatch()(experimental) The glob patterns Jest uses to detect test files.default List<String>getTestPathIgnorePatterns()(experimental) An array of regexp pattern strings that are matched against all test paths before executing the test.default ObjectgetTestRegex()(experimental) The pattern or patterns Jest uses to detect test files.default StringgetTestResultsProcessor()(experimental) This option allows the use of a custom results processor.default StringgetTestRunner()(experimental) This option allows the use of a custom test runner.default StringgetTestSequencer()(experimental) This option allows you to use a custom sequencer instead of Jest's default.default NumbergetTestTimeout()(experimental) Default timeout of a test in milliseconds.default StringgetTestURL()(experimental) This option sets the URL for the jsdom environment.default StringgetTimers()(experimental) Setting this value to legacy or fake allows the use of fake timers for functions such as setTimeout.default Map<String,Transform>getTransform()(experimental) A map from regular expressions to paths to transformers.default List<String>getTransformIgnorePatterns()(experimental) An array of regexp pattern strings that are matched against all source file paths before transformation.default List<String>getUnmockedModulePathPatterns()(experimental) An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them.default BooleangetVerbose()(experimental) Indicates whether each individual test should be reported during the run.default BooleangetWatchman()(experimental) Whether to use watchman for file crawling.default List<String>getWatchPathIgnorePatterns()(experimental) An array of RegExp patterns that are matched against all source file paths before re-running tests in watch mode.default List<WatchPlugin>getWatchPlugins()Default: -
-
-
-
Method Detail
-
getAdditionalOptions
@Stability(Experimental) @Nullable default Map<String,Object> getAdditionalOptions()
(experimental) Escape hatch to allow any value.
-
getAutomock
@Stability(Experimental) @Nullable default Boolean getAutomock()
(experimental) This option tells Jest that all imported modules in your tests should be mocked automatically.All modules used in your tests will have a replacement implementation, keeping the API surface
Default: - false
-
getBail
@Stability(Experimental) @Nullable default Object getBail()
(experimental) By default, Jest runs all tests and produces all errors into the console upon completion.The bail config option can be used here to have Jest stop running tests after n failures. Setting bail to true is the same as setting bail to 1.
Default: - 0
-
getCacheDirectory
@Stability(Experimental) @Nullable default String getCacheDirectory()
(experimental) The directory where Jest should store its cached dependency information.Default: - "/tmp/
"
-
getClearMocks
@Stability(Experimental) @Nullable default Boolean getClearMocks()
(experimental) Automatically clear mock calls and instances before every test.Equivalent to calling jest.clearAllMocks() before each test. This does not remove any mock implementation that may have been provided
Default: true
-
getCollectCoverage
@Stability(Experimental) @Nullable default Boolean getCollectCoverage()
(experimental) Indicates whether the coverage information should be collected while executing the test.Because this retrofits all executed files with coverage collection statements, it may significantly slow down your tests
Default: true
-
getCollectCoverageFrom
@Stability(Experimental) @Nullable default List<String> getCollectCoverageFrom()
(experimental) An array of glob patterns indicating a set of files for which coverage information should be collected.Default: - undefined
-
getCoverageDirectory
@Stability(Experimental) @Nullable default String getCoverageDirectory()
(experimental) The directory where Jest should output its coverage files.Default: "coverage"
-
getCoveragePathIgnorePatterns
@Stability(Experimental) @Nullable default List<String> getCoveragePathIgnorePatterns()
(experimental) An array of regexp pattern strings that are matched against all file paths before executing the test.If the file path matches any of the patterns, coverage information will be skipped
Default: "/node_modules/"
-
getCoverageProvider
@Stability(Experimental) @Nullable default String getCoverageProvider()
(experimental) Indicates which provider should be used to instrument code for coverage.Allowed values are babel (default) or v8
Default: - "babel"
-
getCoverageReporters
@Stability(Experimental) @Nullable default List<String> getCoverageReporters()
(experimental) A list of reporter names that Jest uses when writing coverage reports.Any istanbul reporter can be used
Default: - ["json", "lcov", "text", "clover", "cobertura"]
-
getCoverageThreshold
@Stability(Experimental) @Nullable default CoverageThreshold getCoverageThreshold()
(experimental) Specify the global coverage thresholds.This will be used to configure minimum threshold enforcement for coverage results. Thresholds can be specified as global, as a glob, and as a directory or file path. If thresholds aren't met, jest will fail.
Default: - undefined
-
getDependencyExtractor
@Stability(Experimental) @Nullable default String getDependencyExtractor()
(experimental) This option allows the use of a custom dependency extractor.It must be a node module that exports an object with an extract function
Default: - undefined
-
getDisplayName
@Stability(Experimental) @Nullable default Object getDisplayName()
(experimental) Allows for a label to be printed alongside a test while it is running.Default: - undefined
-
getErrorOnDeprecated
@Stability(Experimental) @Nullable default Boolean getErrorOnDeprecated()
(experimental) Make calling deprecated APIs throw helpful error messages.Useful for easing the upgrade process.
Default: - false
-
getExtraGlobals
@Stability(Experimental) @Nullable default List<String> getExtraGlobals()
(experimental) Test files run inside a vm, which slows calls to global context properties (e.g. Math). With this option you can specify extra properties to be defined inside the vm for faster lookups.Default: - undefined
-
getForceCoverageMatch
@Stability(Experimental) @Nullable default List<String> getForceCoverageMatch()
(experimental) Test files are normally ignored from collecting code coverage.With this option, you can overwrite this behavior and include otherwise ignored files in code coverage.
Default: - ['']
-
getGlobals
@Stability(Experimental) @Nullable default Object getGlobals()
(experimental) A set of global variables that need to be available in all test environments.Default: - {}
-
getGlobalSetup
@Stability(Experimental) @Nullable default String getGlobalSetup()
(experimental) This option allows the use of a custom global setup module which exports an async function that is triggered once before all test suites.This function gets Jest's globalConfig object as a parameter.
Default: - undefined
-
getGlobalTeardown
@Stability(Experimental) @Nullable default String getGlobalTeardown()
(experimental) This option allows the use of a custom global teardown module which exports an async function that is triggered once after all test suites.This function gets Jest's globalConfig object as a parameter.
Default: - undefined
-
getHaste
@Stability(Experimental) @Nullable default HasteConfig getHaste()
(experimental) This will be used to configure the behavior of jest-haste-map, Jest's internal file crawler/cache system.Default: - {}
-
getInjectGlobals
@Stability(Experimental) @Nullable default Boolean getInjectGlobals()
(experimental) Insert Jest's globals (expect, test, describe, beforeEach etc.) into the global environment. If you set this to false, you should import from.Default: - true
-
getMaxConcurrency
@Stability(Experimental) @Nullable default Number getMaxConcurrency()
(experimental) A number limiting the number of tests that are allowed to run at the same time when using test.concurrent. Any test above this limit will be queued and executed once a slot is released.Default: - 5
-
getMaxWorkers
@Stability(Experimental) @Nullable default Object getMaxWorkers()
(experimental) Specifies the maximum number of workers the worker-pool will spawn for running tests.In single run mode, this defaults to the number of the cores available on your machine minus one for the main thread In watch mode, this defaults to half of the available cores on your machine. For environments with variable CPUs available, you can use percentage based configuration: "maxWorkers": "50%"
Default: - the number of the cores available on your machine minus one for the main thread
-
getModuleDirectories
@Stability(Experimental) @Nullable default List<String> getModuleDirectories()
(experimental) An array of directory names to be searched recursively up from the requiring module's location.Setting this option will override the default, if you wish to still search node_modules for packages include it along with any other options: ["node_modules", "bower_components"]
Default: - ["node_modules"]
-
getModuleFileExtensions
@Stability(Experimental) @Nullable default List<String> getModuleFileExtensions()
(experimental) An array of file extensions your modules use.If you require modules without specifying a file extension, these are the extensions Jest will look for, in left-to-right order.
Default: - ["js", "json", "jsx", "ts", "tsx", "node"]
-
getModuleNameMapper
@Stability(Experimental) @Nullable default Map<String,Object> getModuleNameMapper()
(experimental) A map from regular expressions to module names or to arrays of module names that allow to stub out resources, like images or styles with a single module.Default: - null
-
getModulePathIgnorePatterns
@Stability(Experimental) @Nullable default List<String> getModulePathIgnorePatterns()
(experimental) An array of regexp pattern strings that are matched against all module paths before those paths are to be considered 'visible' to the module loader.If a given module's path matches any of the patterns, it will not be require()-able in the test environment.
Default: - []
-
getModulePaths
@Stability(Experimental) @Nullable default List<String> getModulePaths()
(experimental) An alternative API to setting the NODE_PATH env variable, modulePaths is an array of absolute paths to additional locations to search when resolving modules.Use the
string token to include the path to your project's root directory. Example: [" /app/"]. Default: - []
-
getNotify
@Stability(Experimental) @Nullable default Boolean getNotify()
(experimental) Activates notifications for test results.Default: - false
-
getNotifyMode
@Stability(Experimental) @Nullable default String getNotifyMode()
(experimental) Specifies notification mode.Requires notify: true
Default: - failure-change
-
getPreset
@Stability(Experimental) @Nullable default String getPreset()
(experimental) A preset that is used as a base for Jest's configuration.A preset should point to an npm module that has a jest-preset.json or jest-preset.js file at the root.
Default: - undefined
-
getPrettierPath
@Stability(Experimental) @Nullable default String getPrettierPath()
(experimental) Sets the path to the prettier node module used to update inline snapshots.Default: - "prettier"
-
getProjects
@Stability(Experimental) @Nullable default List<Object> getProjects()
(experimental) When the projects configuration is provided with an array of paths or glob patterns, Jest will run tests in all of the specified projects at the same time.This is great for monorepos or when working on multiple projects at the same time.
Default: - undefined
-
getReporters
@Stability(Experimental) @Nullable default List<JestReporter> getReporters()
(experimental) Use this configuration option to add custom reporters to Jest.A custom reporter is a class that implements onRunStart, onTestStart, onTestResult, onRunComplete methods that will be called when any of those events occurs.
Default: - undefined
-
getResetMocks
@Stability(Experimental) @Nullable default Boolean getResetMocks()
(experimental) Automatically reset mock state before every test.Equivalent to calling jest.resetAllMocks() before each test. This will lead to any mocks having their fake implementations removed but does not restore their initial implementation.
Default: - false
-
getResetModules
@Stability(Experimental) @Nullable default Boolean getResetModules()
(experimental) By default, each test file gets its own independent module registry.Enabling resetModules goes a step further and resets the module registry before running each individual test.
Default: - false
-
getResolver
@Stability(Experimental) @Nullable default String getResolver()
(experimental) This option allows the use of a custom resolver.https://jestjs.io/docs/en/configuration#resolver-string
Default: - undefined
-
getRestoreMocks
@Stability(Experimental) @Nullable default Boolean getRestoreMocks()
(experimental) Automatically restore mock state before every test.Equivalent to calling jest.restoreAllMocks() before each test. This will lead to any mocks having their fake implementations removed and restores their initial implementation.
Default: - false
-
getRootDir
@Stability(Experimental) @Nullable default String getRootDir()
(experimental) The root directory that Jest should scan for tests and modules within.If you put your Jest config inside your package.json and want the root directory to be the root of your repo, the value for this config param will default to the directory of the package.json.
Default: - directory of the package.json
-
getRoots
@Stability(Experimental) @Nullable default List<String> getRoots()
(experimental) A list of paths to directories that Jest should use to search for files in.Default: - ["
"]
-
getRunner
@Stability(Experimental) @Nullable default String getRunner()
(experimental) This option allows you to use a custom runner instead of Jest's default test runner.Default: - "jest-runner"
-
getSetupFiles
@Stability(Experimental) @Nullable default List<String> getSetupFiles()
(experimental) A list of paths to modules that run some code to configure or set up the testing environment.Each setupFile will be run once per test file. Since every test runs in its own environment, these scripts will be executed in the testing environment immediately before executing the test code itself.
Default: - []
-
getSetupFilesAfterEnv
@Stability(Experimental) @Nullable default List<String> getSetupFilesAfterEnv()
(experimental) A list of paths to modules that run some code to configure or set up the testing framework before each test file in the suite is executed.Since setupFiles executes before the test framework is installed in the environment, this script file presents you the opportunity of running some code immediately after the test framework has been installed in the environment.
Default: - []
-
getSlowTestThreshold
@Stability(Experimental) @Nullable default Number getSlowTestThreshold()
(experimental) The number of seconds after which a test is considered as slow and reported as such in the results.Default: - 5
-
getSnapshotResolver
@Stability(Experimental) @Nullable default String getSnapshotResolver()
(experimental) The path to a module that can resolve test<->snapshot path.This config option lets you customize where Jest stores snapshot files on disk.
Default: - undefined
-
getSnapshotSerializers
@Stability(Experimental) @Nullable default List<String> getSnapshotSerializers()
(experimental) A list of paths to snapshot serializer modules Jest should use for snapshot testing.Default: = []
-
getTestEnvironment
@Stability(Experimental) @Nullable default String getTestEnvironment()
(experimental) The test environment that will be used for testing.The default environment in Jest is a browser-like environment through jsdom. If you are building a node service, you can use the node option to use a node-like environment instead.
Default: - "jsdom"
-
getTestEnvironmentOptions
@Stability(Experimental) @Nullable default Object getTestEnvironmentOptions()
(experimental) Test environment options that will be passed to the testEnvironment.The relevant options depend on the environment.
Default: - {}
-
getTestFailureExitCode
@Stability(Experimental) @Nullable default Number getTestFailureExitCode()
(experimental) The exit code Jest returns on test failure.Default: - 1
-
getTestMatch
@Stability(Experimental) @Nullable default List<String> getTestMatch()
(experimental) The glob patterns Jest uses to detect test files.By default it looks for .js, .jsx, .ts and .tsx files inside of tests folders, as well as any files with a suffix of .test or .spec (e.g. Component.test.js or Component.spec.js). It will also find files called test.js or spec.js.
Default: ['**\/__tests__/**\/*.[jt]s?(x)', '**\/?(*.)+(spec|test).[tj]s?(x)']
-
getTestPathIgnorePatterns
@Stability(Experimental) @Nullable default List<String> getTestPathIgnorePatterns()
(experimental) An array of regexp pattern strings that are matched against all test paths before executing the test.If the test path matches any of the patterns, it will be skipped.
Default: - ["/node_modules/"]
-
getTestRegex
@Stability(Experimental) @Nullable default Object getTestRegex()
(experimental) The pattern or patterns Jest uses to detect test files.By default it looks for .js, .jsx, .ts and .tsx files inside of tests folders, as well as any files with a suffix of .test or .spec (e.g. Component.test.js or Component.spec.js). It will also find files called test.js or spec.js.
Default: - (/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$
-
getTestResultsProcessor
@Stability(Experimental) @Nullable default String getTestResultsProcessor()
(experimental) This option allows the use of a custom results processor.Default: - undefined
-
getTestRunner
@Stability(Experimental) @Nullable default String getTestRunner()
(experimental) This option allows the use of a custom test runner.The default is jasmine2. A custom test runner can be provided by specifying a path to a test runner implementation.
Default: - "jasmine2"
-
getTestSequencer
@Stability(Experimental) @Nullable default String getTestSequencer()
(experimental) This option allows you to use a custom sequencer instead of Jest's default.Sort may optionally return a Promise.
Default: - "@jest/test-sequencer"
-
getTestTimeout
@Stability(Experimental) @Nullable default Number getTestTimeout()
(experimental) Default timeout of a test in milliseconds.Default: - 5000
-
getTestURL
@Stability(Experimental) @Nullable default String getTestURL()
(experimental) This option sets the URL for the jsdom environment.It is reflected in properties such as location.href.
Default: - "http://localhost"
-
getTimers
@Stability(Experimental) @Nullable default String getTimers()
(experimental) Setting this value to legacy or fake allows the use of fake timers for functions such as setTimeout.Fake timers are useful when a piece of code sets a long timeout that we don't want to wait for in a test.
Default: - "real"
-
getTransform
@Stability(Experimental) @Nullable default Map<String,Transform> getTransform()
(experimental) A map from regular expressions to paths to transformers.A transformer is a module that provides a synchronous function for transforming source files.
Default: - {"\\.[jt]sx?$": "babel-jest"}
-
getTransformIgnorePatterns
@Stability(Experimental) @Nullable default List<String> getTransformIgnorePatterns()
(experimental) An array of regexp pattern strings that are matched against all source file paths before transformation.If the test path matches any of the patterns, it will not be transformed.
Default: - ["/node_modules/", "\\.pnp\\.[^\\\/]+$"]
-
getUnmockedModulePathPatterns
@Stability(Experimental) @Nullable default List<String> getUnmockedModulePathPatterns()
(experimental) An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them.If a module's path matches any of the patterns in this list, it will not be automatically mocked by the module loader.
Default: - []
-
getVerbose
@Stability(Experimental) @Nullable default Boolean getVerbose()
(experimental) Indicates whether each individual test should be reported during the run.All errors will also still be shown on the bottom after execution. Note that if there is only one test file being run it will default to true.
Default: - false
-
getWatchman
@Stability(Experimental) @Nullable default Boolean getWatchman()
(experimental) Whether to use watchman for file crawling.Default: - true
-
getWatchPathIgnorePatterns
@Stability(Experimental) @Nullable default List<String> getWatchPathIgnorePatterns()
(experimental) An array of RegExp patterns that are matched against all source file paths before re-running tests in watch mode.If the file path matches any of the patterns, when it is updated, it will not trigger a re-run of tests.
Default: - []
-
getWatchPlugins
@Stability(Experimental) @Nullable default List<WatchPlugin> getWatchPlugins()
Default: -
-
builder
@Stability(Experimental) static JestConfigOptions.Builder builder()
- Returns:
- a
JestConfigOptions.BuilderofJestConfigOptions
-
-