UNPKG

@angular-builders/jest

Version:

Jest runner for Angular build facade. Allows ng test run with Jest instead of Karma

534 lines (533 loc) 21.7 kB
{ "$id": "JestRunnerSchema", "title": "Jest runner for build facade", "description": "Jest runner options", "properties": { "config": { "description": "Path to jest config file, or a Jest configuration object. If not specified, Jest will look for jest.config.js in the project root.", "type": ["string", "object"], "default": "jest.config.js" }, "globalMocks": { "description": "Enabled global mocks. Only 'matchMedia' is supported in v21+.", "type": "array", "items": { "type": "string", "enum": ["matchMedia"] }, "default": ["matchMedia"] }, "zoneless": { "description": "Use zoneless testing environment. When true (default), configures Jest for Angular 21+ zoneless applications. When false, configures Jest for applications that require zone.js change detection.", "type": "boolean", "default": true }, "all": { "description": "The opposite of `onlyChanged`. If `onlyChanged` is set by default, running jest with `--all` will force Jest to run all tests instead of running only tests related to changed files." }, "automock": { "description": "Automock all files by default.", "type": "boolean" }, "bail": { "alias": "b", "description": "Exit the test suite immediately upon the first failing test.", "type": "boolean" }, "cache": { "description": "Whether to use the transform cache. Disable the cache using --no-cache.", "type": "boolean" }, "cacheDirectory": { "description": "The directory where Jest should store its cached dependency information.", "type": "string" }, "changedFilesWithAncestor": { "description": "Runs tests related to the current changes and the changes made in the last commit. Behaves similarly to `--onlyChanged`.", "type": "boolean" }, "changedSince": { "description": "Runs tests related the changes since the provided branch. If the current branch has diverged from the given branch, then only changes made locally will be tested. Behaves similarly to `--onlyChanged`.", "nargs": 1, "type": "string" }, "ci": { "default": false, "description": "Whether to run Jest in continuous integration (CI) mode.", "type": "boolean" }, "clearCache": { "description": "Clears the configured Jest cache directory and then exits. Default directory can be found by calling jest --showConfig", "type": "boolean" }, "clearMocks": { "description": "Automatically clear mock calls and instances between every test. Equivalent to calling jest.clearAllMocks() between each test.", "type": "boolean" }, "collectCoverage": { "description": "Alias for --coverage.", "type": "boolean" }, "collectCoverageFrom": { "description": "An array of glob patterns indicating a set of files for which coverage information should be collected. If a file matches the specified glob pattern, coverage information will be collected for it even if no tests exist for this file and it's never required in the test suite", "type": "array", "items": { "type": "string" } }, "color": { "description": "Forces test results output color highlighting (even if stdout is not a TTY). Set to false if you would like to have no colors.", "type": "boolean" }, "colors": { "description": "Alias for `--color`.", "type": "boolean" }, "coverage": { "description": "Indicates that test coverage information should be collected and reported in the output.", "type": "boolean" }, "coverageDirectory": { "description": "The directory where Jest should output its coverage files.", "type": "string" }, "coveragePathIgnorePatterns": { "description": "An array of regexp pattern strings that are matched against all file paths before executing the test. If the file pathmatches any of the patterns, coverage information will be skipped.", "type": "array", "items": { "type": "string" } }, "coverageReporters": { "description": "A list of reporter names that Jest uses when writing coverage reports. Any istanbul reporter can be used.", "type": "array", "items": { "type": "string" } }, "coverageThreshold": { "description": "A JSON string with which will be used to configure minimum threshold enforcement for coverage results", "type": "string" }, "coverageProvider": { "description": "Select between Babel and V8 to collect coverage.", "type": "string", "enum": ["babel", "v8"] }, "debug": { "description": "Print debugging info about your jest config.", "type": "boolean" }, "detectLeaks": { "default": false, "description": "**EXPERIMENTAL**: Detect memory leaks in tests. After executing a test, it will try to garbage collect the global object used, and fail if it was leaked", "type": "boolean" }, "detectOpenHandles": { "default": false, "description": "Print out remaining open handles preventing Jest from exiting at the end of a test run.", "type": "boolean" }, "env": { "description": "The test environment used for all tests. This can point to any file or node module. Examples: `jsdom`, `node` or `path/to/my-environment.js`", "type": "string" }, "errorOnDeprecated": { "default": false, "description": "Make calling deprecated APIs throw helpful error messages.", "type": "boolean" }, "expand": { "alias": "e", "description": "Use this flag to show full diffs instead of a patch.", "type": "boolean" }, "filter": { "description": "Path to a module exporting a filtering function. This method receives a list of tests which can be manipulated to exclude tests from running. Especially useful when used in conjunction with a testing infrastructure to filter known broken tests.", "type": "string" }, "findRelatedTests": { "description": "Find related tests for a list of source files that were passed in as arguments. Useful for pre-commit hook integration to run the minimal amount of tests necessary.", "type": "array", "items": { "type": "string" } }, "forceExit": { "description": "Force Jest to exit after all tests have completed running. This is useful when resources set up by test code cannot be adequately cleaned up.", "type": "boolean" }, "globalSetup": { "description": "The path to a module that runs before All Tests.", "type": "string" }, "globalTeardown": { "description": "The path to a module that runs after All Tests.", "type": "string" }, "globals": { "description": "A JSON string with map of global variables that need to be available in all test environments.", "type": "string" }, "haste": { "description": "A JSON string with map of variables for the haste module system", "type": "string" }, "ignoreProjects": { "description": "Ignore the tests of the specified projects. Jest uses the attribute `displayName` in the configuration to identify each project.", "type": "array", "items": { "type": "string" } }, "injectGlobals": { "description": "Should Jest inject global variables or not.", "type": "boolean" }, "json": { "description": "Prints the test results in JSON. This mode will send all other test output and user messages to stderr.", "type": "boolean" }, "lastCommit": { "description": "Run all tests affected by file changes in the last commit made. Behaves similarly to `--onlyChanged`.", "type": "boolean" }, "listTests": { "default": false, "description": "Lists all tests Jest will run given the arguments and exits. Most useful in a CI system together with `--findRelatedTests` to determine the tests Jest will run based on specific files", "type": "boolean" }, "logHeapUsage": { "description": "Logs the heap usage after every test. Useful to debug memory leaks. Use together with `--runInBand` and `--expose-gc` in node.", "type": "boolean" }, "maxConcurrency": { "description": "Specifies the maximum number of tests that are allowed to run concurrently. This only affects tests using `test.concurrent`.", "type": "number" }, "maxWorkers": { "alias": "w", "description": "Specifies the maximum number of workers the worker-pool will spawn for running tests. This defaults to the number of the cores available on your machine. (its usually best not to override this default)", "type": ["integer", "string"] }, "moduleDirectories": { "description": "An array of directory names to be searched recursively up from the requiring module's location.", "type": "array", "items": { "type": "string" } }, "moduleFileExtensions": { "description": "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. ", "type": "array", "items": { "type": "string" } }, "moduleNameMapper": { "description": "A JSON string with a map from regular expressions to module names that allow to stub out resources, like images or styles with a single module", "type": "string" }, "modulePathIgnorePatterns": { "description": "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.", "type": "array", "items": { "type": "string" } }, "modulePaths": { "description": "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.", "type": "array", "items": { "type": "string" } }, "noStackTrace": { "description": "Disables stack trace in test results output", "type": "boolean" }, "notify": { "description": "Activates notifications for test results.", "type": "boolean" }, "notifyMode": { "default": "failure-change", "description": "Specifies when notifications will appear for test results.", "type": "string" }, "onlyChanged": { "alias": "o", "description": "Attempts to identify which tests to run based on which files have changed in the current repository. Only works if you're running tests in a git or hg repository at the moment.", "type": "boolean" }, "onlyFailures": { "alias": "f", "description": "Run tests that failed in the previous execution.", "type": "boolean" }, "openHandlesTimeout": { "description": "Print a warning about probable open handles if Jest does not exit cleanly after this number of milliseconds. `0` to disable.", "type": "number" }, "outputFile": { "description": "Write test results to a file when the --json option is also specified.", "type": "string" }, "passWithNoTests": { "default": false, "description": "Will not fail if no tests are found (for example while using `--testPathPatterns`.)", "type": "boolean" }, "preset": { "description": "A preset that is used as a base for Jest's configuration.", "type": "string" }, "prettierPath": { "default": "prettier", "description": "The path to the \"prettier\" module used for inline snapshots.", "type": "string" }, "projects": { "description": "A list of projects that use Jest to run all tests of all projects in a single instance of Jest.", "type": "array", "items": { "type": "string" } }, "randomize": { "description": "Shuffle the order of the tests within a file. Use `--seed` to specify the seed value.", "type": "boolean" }, "reporters": { "description": "A list of custom reporters for the test suite.", "type": "array", "items": { "type": "string" } }, "resetMocks": { "description": "Automatically reset mock state between every test. Equivalent to calling jest.resetAllMocks() between each test.", "type": "boolean" }, "resetModules": { "description": "If enabled, the module registry for every test file will be reset before running each individual test.", "type": "boolean" }, "resolver": { "description": "A JSON string which allows the use of a custom resolver.", "type": "string" }, "restoreMocks": { "description": "Automatically restore mock state and implementation between every test. Equivalent to calling jest.restoreAllMocks() between each test.", "type": "boolean" }, "rootDir": { "description": "The root directory that Jest should scan for tests and modules within.", "type": "string" }, "roots": { "description": "A list of paths to directories that Jest should use to search for files in.", "type": "array", "items": { "type": "string" } }, "runInBand": { "alias": "i", "description": "Run all tests serially in the current process (rather than creating a worker pool of child processes that run tests). This is sometimes useful for debugging, but such use cases are pretty rare.", "type": "boolean" }, "runTestsByPath": { "default": false, "description": "Used when provided patterns are exact file paths. This avoids converting them into a regular expression and matching it against every single file.", "type": "boolean" }, "runner": { "description": "Allows to use a custom runner instead of Jest's default test runner.", "type": "string" }, "seed": { "description": "Sets a seed value that can be retrieved in a tests file via `jest.getSeed()`. The seed value must be between `-0x80000000` and `0x7fffffff` inclusive.", "type": "number" }, "selectProjects": { "description": "Run the tests of the specified projects. Jest uses the attribute `displayName` in the configuration to identify each project.", "type": "array", "items": { "type": "string" } }, "setupFiles": { "description": "The paths to modules that run some code to configure or set up the testing environment before each test. ", "type": "array", "items": { "type": "string" } }, "setupFilesAfterEnv": { "description": "A list of paths to modules that run some code to configure or set up the testing framework before each test.", "type": "string" }, "showConfig": { "description": "Print your jest config and then exits.", "type": "boolean" }, "showSeed": { "description": "Prints the seed value in the test report summary. See `--seed` for how to set this value.", "type": "boolean" }, "silent": { "description": "Prevent tests from printing messages through the console.", "type": "boolean" }, "skipFilter": { "description": "Disables the filter provided by --filter. Useful for CI jobs, or local enforcement when fixing tests.", "type": "boolean" }, "snapshotSerializers": { "description": "A list of paths to snapshot serializer modules Jest should use for snapshot testing.", "type": "array", "items": { "type": "string" } }, "testEnvironment": { "description": "Alias for --env", "type": "string" }, "testEnvironmentOptions": { "description": "Test environment options that will be passed to the testEnvironment. The relevant options depend on the environment.", "type": "string" }, "testFailureExitCode": { "description": "Exit code of `jest` command if the test run failed", "type": "string" }, "testLocationInResults": { "default": false, "description": "Add `location` information to the test results", "type": "boolean" }, "testMatch": { "description": "The glob patterns Jest uses to detect test files.", "type": "array", "items": { "type": "string" } }, "testNamePattern": { "alias": "t", "description": "Run only tests with a name that matches the regex pattern.", "type": "string" }, "testPathIgnorePatterns": { "description": "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.", "type": "array", "items": { "type": "string" } }, "testPathPatterns": { "description": "Regexp pattern strings matched against test paths. Pass multiple patterns separated by spaces or repeat the flag.", "type": "array", "items": { "type": "string" } }, "testRegex": { "description": "A string or array of string regexp patterns that Jest uses to detect test files.", "type": "array", "items": { "type": "string" } }, "testResultsProcessor": { "description": "Allows the use of a custom results processor. This processor must be a node module that exports a function expecting as the first argument the result object.", "type": "string" }, "testRunner": { "description": "Allows to specify a custom test runner. The default is `jest-circus/runner`. A path to a custom test runner can be provided: `<rootDir>/path/to/testRunner.js`.", "type": "string" }, "testSequencer": { "description": "Allows to specify a custom test sequencer. The default is `@jest/test-sequencer`. A path to a custom test sequencer can be provided: `<rootDir>/path/to/testSequencer.js`.", "type": "string" }, "testTimeout": { "description": "This option sets the default timeouts of test cases.", "type": "number" }, "transform": { "description": "A JSON string which maps from regular expressions to paths to transformers.", "type": "string" }, "transformIgnorePatterns": { "description": "An array of regexp pattern strings that are matched against all source file paths before transformation.", "type": "array", "items": { "type": "string" } }, "unmockedModulePathPatterns": { "description": "An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them.", "type": "array", "items": { "type": "string" } }, "updateSnapshot": { "alias": "u", "description": "Use this flag to re-record snapshots. Can be used together with a test suite pattern or with `--testNamePattern` to re-record snapshot for test matching the pattern", "type": "boolean" }, "useStderr": { "description": "Divert all output to stderr.", "type": "boolean" }, "verbose": { "description": "Display individual test results with the test suite hierarchy.", "type": "boolean" }, "version": { "alias": "v", "description": "Print the version and exit", "type": "boolean" }, "watch": { "description": "Watch files for changes and rerun tests related to changed files. If you want to re-run all tests when a file has changed, use the `--watchAll` option.", "type": "boolean" }, "watchAll": { "description": "Watch files for changes and rerun all tests. If you want to re-run only the tests related to the changed files, use the `--watch` option.", "type": "boolean" }, "watchPathIgnorePatterns": { "description": "An array of regexp pattern strings that are matched against all paths before trigger test re-run in watch mode. If the test path matches any of the patterns, it will be skipped.", "type": "array", "items": { "type": "string" } }, "watchman": { "description": "Whether to use watchman for file crawling. Disable using --no-watchman.", "type": "boolean" }, "waitForUnhandledRejections": { "description": "Gives one event loop turn to handle `rejectionHandled`, `uncaughtException` or `unhandledRejection`.", "type": "boolean" }, "workerThreads": { "description": "Whether to use worker threads for parallelization. Child processes are used by default.", "type": "boolean" }, "tsConfig": { "description": "The path to the TypeScript configuration file.", "type": "string" }, "shard": { "description": "The test suite shard to execute in a format of (?<shardIndex>\\d+)/(?<shardCount>\\d+).\n\nshardIndex describes which shard to select while shardCount controls the number of shards the suite should be split into.\n\nshardIndex and shardCount have to be 1-based, positive numbers, and shardIndex has to be lower than or equal to shardCount.\n\nWhen shard is specified the configured testSequencer has to implement a shard method.\n\nFor example, to split the suite into three shards, each running one third of the tests:", "type": "string" } }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }