@Stability(value=Experimental) public static final class JestConfigOptions.Builder extends Object implements software.amazon.jsii.Builder<JestConfigOptions>
JestConfigOptions| Constructor and Description |
|---|
Builder() |
@Stability(value=Experimental) public JestConfigOptions.Builder automock(Boolean automock)
JestConfigOptions.getAutomock()automock - 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 surfacethis@Stability(value=Experimental) public JestConfigOptions.Builder bail(Number bail)
JestConfigOptions.getBail()bail - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder bail(Boolean bail)
JestConfigOptions.getBail()bail - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder cacheDirectory(String cacheDirectory)
JestConfigOptions.getCacheDirectory()cacheDirectory - The directory where Jest should store its cached dependency information.this@Stability(value=Experimental) public JestConfigOptions.Builder clearMocks(Boolean clearMocks)
JestConfigOptions.getClearMocks()clearMocks - 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 providedthis@Stability(value=Experimental) public JestConfigOptions.Builder collectCoverage(Boolean collectCoverage)
JestConfigOptions.getCollectCoverage()collectCoverage - 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 teststhis@Stability(value=Experimental) public JestConfigOptions.Builder collectCoverageFrom(List<String> collectCoverageFrom)
JestConfigOptions.getCollectCoverageFrom()collectCoverageFrom - An array of glob patterns indicating a set of files for which coverage information should be collected.this@Stability(value=Experimental) public JestConfigOptions.Builder coverageDirectory(String coverageDirectory)
JestConfigOptions.getCoverageDirectory()coverageDirectory - The directory where Jest should output its coverage files.this@Stability(value=Experimental) public JestConfigOptions.Builder coveragePathIgnorePatterns(List<String> coveragePathIgnorePatterns)
JestConfigOptions.getCoveragePathIgnorePatterns()coveragePathIgnorePatterns - 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 skippedthis@Stability(value=Experimental) public JestConfigOptions.Builder coverageProvider(String coverageProvider)
JestConfigOptions.getCoverageProvider()coverageProvider - Indicates which provider should be used to instrument code for coverage.
Allowed values are babel (default) or v8this@Stability(value=Experimental) public JestConfigOptions.Builder coverageReporters(List<String> coverageReporters)
JestConfigOptions.getCoverageReporters()coverageReporters - A list of reporter names that Jest uses when writing coverage reports.
Any istanbul reporter can be usedthis@Stability(value=Experimental) public JestConfigOptions.Builder coverageThreshold(CoverageThreshold coverageThreshold)
JestConfigOptions.getCoverageThreshold()coverageThreshold - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder dependencyExtractor(String dependencyExtractor)
JestConfigOptions.getDependencyExtractor()dependencyExtractor - This option allows the use of a custom dependency extractor.
It must be a node module that exports an object with an extract functionthis@Stability(value=Experimental) public JestConfigOptions.Builder displayName(Object displayName)
JestConfigOptions.getDisplayName()displayName - Allows for a label to be printed alongside a test while it is running.this@Stability(value=Experimental) public JestConfigOptions.Builder errorOnDeprecated(Boolean errorOnDeprecated)
JestConfigOptions.getErrorOnDeprecated()errorOnDeprecated - Make calling deprecated APIs throw helpful error messages.
Useful for easing the upgrade process.this@Stability(value=Experimental) public JestConfigOptions.Builder extraGlobals(List<String> extraGlobals)
JestConfigOptions.getExtraGlobals()extraGlobals - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder forceCoverageMatch(List<String> forceCoverageMatch)
JestConfigOptions.getForceCoverageMatch()forceCoverageMatch - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder globals(Object globals)
JestConfigOptions.getGlobals()globals - A set of global variables that need to be available in all test environments.this@Stability(value=Experimental) public JestConfigOptions.Builder globalSetup(String globalSetup)
JestConfigOptions.getGlobalSetup()globalSetup - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder globalTeardown(String globalTeardown)
JestConfigOptions.getGlobalTeardown()globalTeardown - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder haste(HasteConfig haste)
JestConfigOptions.getHaste()haste - This will be used to configure the behavior of jest-haste-map, Jest's internal file crawler/cache system.this@Stability(value=Experimental) public JestConfigOptions.Builder injectGlobals(Boolean injectGlobals)
JestConfigOptions.getInjectGlobals()injectGlobals - Insert Jest's globals (expect, test, describe, beforeEach etc.) into the global environment. If you set this to false, you should import from @jest/globals.this@Stability(value=Experimental) public JestConfigOptions.Builder maxConcurrency(Number maxConcurrency)
JestConfigOptions.getMaxConcurrency()maxConcurrency - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder moduleDirectories(List<String> moduleDirectories)
JestConfigOptions.getModuleDirectories()moduleDirectories - 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"]this@Stability(value=Experimental) public JestConfigOptions.Builder moduleFileExtensions(List<String> moduleFileExtensions)
JestConfigOptions.getModuleFileExtensions()moduleFileExtensions - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder moduleNameMapper(Map<String,? extends Object> moduleNameMapper)
JestConfigOptions.getModuleNameMapper()moduleNameMapper - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder modulePathIgnorePatterns(List<String> modulePathIgnorePatterns)
JestConfigOptions.getModulePathIgnorePatterns()modulePathIgnorePatterns - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder modulePaths(List<String> modulePaths)
JestConfigOptions.getModulePaths()modulePaths - 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 this@Stability(value=Experimental) public JestConfigOptions.Builder notify(Boolean notify)
JestConfigOptions.getNotify()notify - Activates notifications for test results.this@Stability(value=Experimental) public JestConfigOptions.Builder notifyMode(String notifyMode)
JestConfigOptions.getNotifyMode()notifyMode - Specifies notification mode.
Requires notify: truethis@Stability(value=Experimental) public JestConfigOptions.Builder preset(String preset)
JestConfigOptions.getPreset()preset - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder prettierPath(String prettierPath)
JestConfigOptions.getPrettierPath()prettierPath - Sets the path to the prettier node module used to update inline snapshots.this@Stability(value=Experimental) public JestConfigOptions.Builder projects(List<? extends Object> projects)
JestConfigOptions.getProjects()projects - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder reporters(List<? extends Object> reporters)
JestConfigOptions.getReporters()reporters - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder resetMocks(Boolean resetMocks)
JestConfigOptions.getResetMocks()resetMocks - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder resetModules(Boolean resetModules)
JestConfigOptions.getResetModules()resetModules - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder resolver(String resolver)
JestConfigOptions.getResolver()resolver - This option allows the use of a custom resolver.
https://jestjs.io/docs/en/configuration#resolver-stringthis@Stability(value=Experimental) public JestConfigOptions.Builder restoreMocks(Boolean restoreMocks)
JestConfigOptions.getRestoreMocks()restoreMocks - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder rootDir(String rootDir)
JestConfigOptions.getRootDir()rootDir - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder roots(List<String> roots)
JestConfigOptions.getRoots()roots - A list of paths to directories that Jest should use to search for files in.this@Stability(value=Experimental) public JestConfigOptions.Builder runner(String runner)
JestConfigOptions.getRunner()runner - This option allows you to use a custom runner instead of Jest's default test runner.this@Stability(value=Experimental) public JestConfigOptions.Builder setupFiles(List<String> setupFiles)
JestConfigOptions.getSetupFiles()setupFiles - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder setupFilesAfterEnv(List<String> setupFilesAfterEnv)
JestConfigOptions.getSetupFilesAfterEnv()setupFilesAfterEnv - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder slowTestThreshold(Number slowTestThreshold)
JestConfigOptions.getSlowTestThreshold()slowTestThreshold - The number of seconds after which a test is considered as slow and reported as such in the results.this@Stability(value=Experimental) public JestConfigOptions.Builder snapshotResolver(String snapshotResolver)
JestConfigOptions.getSnapshotResolver()snapshotResolver - The path to a module that can resolve test<->snapshot path.
This config option lets you customize
where Jest stores snapshot files on disk.this@Stability(value=Experimental) public JestConfigOptions.Builder snapshotSerializers(List<String> snapshotSerializers)
JestConfigOptions.getSnapshotSerializers()snapshotSerializers - A list of paths to snapshot serializer modules Jest should use for snapshot testing.this@Stability(value=Experimental) public JestConfigOptions.Builder testEnvironment(String testEnvironment)
JestConfigOptions.getTestEnvironment()testEnvironment - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder testEnvironmentOptions(Object testEnvironmentOptions)
JestConfigOptions.getTestEnvironmentOptions()testEnvironmentOptions - Test environment options that will be passed to the testEnvironment.
The relevant options depend on the environment.this@Stability(value=Experimental) public JestConfigOptions.Builder testFailureExitCode(Number testFailureExitCode)
JestConfigOptions.getTestFailureExitCode()testFailureExitCode - The exit code Jest returns on test failure.this@Stability(value=Experimental) public JestConfigOptions.Builder testMatch(List<String> testMatch)
JestConfigOptions.getTestMatch()testMatch - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder testPathIgnorePatterns(List<String> testPathIgnorePatterns)
JestConfigOptions.getTestPathIgnorePatterns()testPathIgnorePatterns - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder testRegex(String testRegex)
JestConfigOptions.getTestRegex()testRegex - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder testRegex(List<String> testRegex)
JestConfigOptions.getTestRegex()testRegex - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder testResultsProcessor(String testResultsProcessor)
JestConfigOptions.getTestResultsProcessor()testResultsProcessor - This option allows the use of a custom results processor.this@Stability(value=Experimental) public JestConfigOptions.Builder testRunner(String testRunner)
JestConfigOptions.getTestRunner()testRunner - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder testSequencer(String testSequencer)
JestConfigOptions.getTestSequencer()testSequencer - This option allows you to use a custom sequencer instead of Jest's default.
Sort may optionally return a Promise.this@Stability(value=Experimental) public JestConfigOptions.Builder testTimeout(Number testTimeout)
JestConfigOptions.getTestTimeout()testTimeout - Default timeout of a test in milliseconds.this@Stability(value=Experimental) public JestConfigOptions.Builder testUrl(String testUrl)
JestConfigOptions#getTestUrltestUrl - This option sets the URL for the jsdom environment.
It is reflected in properties such as location.href.this@Stability(value=Experimental) public JestConfigOptions.Builder timers(String timers)
JestConfigOptions.getTimers()timers - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder transform(Map<String,? extends Object> transform)
JestConfigOptions.getTransform()transform - A map from regular expressions to paths to transformers.
A transformer is a module that provides a
synchronous function for transforming source files.this@Stability(value=Experimental) public JestConfigOptions.Builder transformIgnorePatterns(List<String> transformIgnorePatterns)
JestConfigOptions.getTransformIgnorePatterns()transformIgnorePatterns - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder unmockedModulePathPatterns(List<String> unmockedModulePathPatterns)
JestConfigOptions.getUnmockedModulePathPatterns()unmockedModulePathPatterns - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder verbose(Boolean verbose)
JestConfigOptions.getVerbose()verbose - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder watchman(Boolean watchman)
JestConfigOptions.getWatchman()watchman - Whether to use watchman for file crawling.this@Stability(value=Experimental) public JestConfigOptions.Builder watchPathIgnorePatterns(List<String> watchPathIgnorePatterns)
JestConfigOptions.getWatchPathIgnorePatterns()watchPathIgnorePatterns - 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.this@Stability(value=Experimental) public JestConfigOptions.Builder watchPlugins(com.fasterxml.jackson.databind.node.ObjectNode watchPlugins)
JestConfigOptions.getWatchPlugins()watchPlugins - the value to be set.this@Stability(value=Experimental) public JestConfigOptions build()
build in interface software.amazon.jsii.Builder<JestConfigOptions>JestConfigOptionsNullPointerException - if any required attribute was not providedCopyright © 2021. All rights reserved.