{
  "$schema": "http://json-schema.org/draft-07/schema",
  "title": "Unit testing",
  "description": "Unit testing options for Angular applications.",
  "type": "object",
  "properties": {
    "buildTarget": {
      "type": "string",
      "description": "Specifies the build target to use for the unit test build in the format `project:target[:configuration]`. This defaults to the `build` target of the current project with the `development` configuration. You can also pass a comma-separated list of configurations. Example: `project:target:production,staging`.",
      "pattern": "^[^:\\s]*:[^:\\s]*(:[^\\s]+)?$"
    },
    "tsConfig": {
      "type": "string",
      "description": "The path to the TypeScript configuration file, relative to the workspace root. Defaults to `tsconfig.spec.json` in the project root if it exists. If not specified and the default does not exist, the `tsConfig` from the specified `buildTarget` will be used."
    },
    "runner": {
      "type": "string",
      "description": "Specifies the test runner to use for test execution.",
      "default": "vitest",
      "enum": ["karma", "vitest"]
    },
    "runnerConfig": {
      "type": ["string", "boolean"],
      "description": "Specifies the configuration file for the selected test runner. If a string is provided, it will be used as the path to the configuration file. If `true`, the builder will search for a default configuration file (e.g., `vitest.config.ts` or `karma.conf.js`). If `false`, no external configuration file will be used.\\nFor Vitest, this enables advanced options and the use of custom plugins. Please note that while the file is loaded, the Angular team does not provide direct support for its specific contents or any third-party plugins used within it.",
      "default": false
    },
    "browsers": {
      "description": "Specifies the browsers to use for test execution. When not specified, tests are run in a Node.js environment using jsdom. For both Vitest and Karma, browser names ending with 'Headless' (e.g., 'ChromeHeadless') will enable headless mode.",
      "type": "array",
      "items": {
        "type": "string"
      },
      "minItems": 1
    },
    "browserViewport": {
      "description": "Specifies the browser viewport dimensions for browser-based tests in the format `widthxheight`.",
      "type": "string",
      "pattern": "^\\d+x\\d+$"
    },
    "include": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "default": ["**/*.spec.ts", "**/*.test.ts"],
      "description": "Specifies glob patterns of files to include for testing, relative to the project root. This option also has special handling for directory paths (includes all test files within) and file paths (includes the corresponding test file if one exists)."
    },
    "exclude": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Specifies glob patterns of files to exclude from testing, relative to the project root."
    },
    "filter": {
      "type": "string",
      "description": "Specifies a regular expression pattern to match against test suite and test names. Only tests with a name matching the pattern will be executed. For example, `^App` will run only tests in suites beginning with 'App'."
    },
    "watch": {
      "type": "boolean",
      "description": "Enables watch mode, which re-runs tests when source files change. Defaults to `true` in TTY environments and `false` otherwise."
    },
    "headless": {
      "type": "boolean",
      "description": "Forces all configured browsers to run in headless mode. When using the Vitest runner, this option is ignored if no browsers are configured. The Karma runner does not support this option."
    },
    "debug": {
      "type": "boolean",
      "description": "Enables debugging mode for tests, allowing the use of the Node Inspector.",
      "default": false
    },
    "ui": {
      "type": "boolean",
      "description": "Enables the Vitest UI for interactive test execution. This option is only available for the Vitest runner."
    },
    "coverage": {
      "type": "boolean",
      "description": "Enables coverage reporting for tests. If not specified, the coverage configuration from a runner configuration file will be used if present. Otherwise, coverage is disabled by default."
    },
    "coverageInclude": {
      "type": "array",
      "description": "Specifies glob patterns of files to include in the coverage report.",
      "items": {
        "type": "string"
      }
    },
    "coverageExclude": {
      "type": "array",
      "description": "Specifies glob patterns of files to exclude from the coverage report.",
      "items": {
        "type": "string"
      }
    },
    "coverageReporters": {
      "type": "array",
      "description": "Specifies the reporters to use for coverage results. Each reporter can be a string representing its name, or a tuple containing the name and an options object. Built-in reporters include 'html', 'lcov', 'lcovonly', 'text', 'text-summary', 'cobertura', 'json', and 'json-summary'.",
      "items": {
        "oneOf": [
          {
            "enum": [
              "html",
              "lcov",
              "lcovonly",
              "text",
              "text-summary",
              "cobertura",
              "json",
              "json-summary"
            ]
          },
          {
            "type": "array",
            "minItems": 1,
            "maxItems": 2,
            "items": [
              {
                "enum": [
                  "html",
                  "lcov",
                  "lcovonly",
                  "text",
                  "text-summary",
                  "cobertura",
                  "json",
                  "json-summary"
                ]
              },
              {
                "type": "object"
              }
            ]
          }
        ]
      }
    },
    "coverageThresholds": {
      "type": "object",
      "description": "Specifies minimum coverage thresholds that must be met. If thresholds are not met, the builder will exit with an error.",
      "properties": {
        "perFile": {
          "type": "boolean",
          "description": "When true, thresholds are enforced for each file individually."
        },
        "statements": {
          "type": "number",
          "description": "Minimum percentage of statements covered."
        },
        "branches": {
          "type": "number",
          "description": "Minimum percentage of branches covered."
        },
        "functions": {
          "type": "number",
          "description": "Minimum percentage of functions covered."
        },
        "lines": {
          "type": "number",
          "description": "Minimum percentage of lines covered."
        }
      },
      "additionalProperties": false
    },
    "coverageWatermarks": {
      "type": "object",
      "description": "Specifies coverage watermarks for the HTML reporter. These determine the color coding for high, medium, and low coverage.",
      "properties": {
        "statements": {
          "type": "array",
          "description": "The high and low watermarks for statements coverage. `[low, high]`",
          "items": { "type": "number" },
          "minItems": 2,
          "maxItems": 2
        },
        "branches": {
          "type": "array",
          "description": "The high and low watermarks for branches coverage. `[low, high]`",
          "items": { "type": "number" },
          "minItems": 2,
          "maxItems": 2
        },
        "functions": {
          "type": "array",
          "description": "The high and low watermarks for functions coverage. `[low, high]`",
          "items": { "type": "number" },
          "minItems": 2,
          "maxItems": 2
        },
        "lines": {
          "type": "array",
          "description": "The high and low watermarks for lines coverage. `[low, high]`",
          "items": { "type": "number" },
          "minItems": 2,
          "maxItems": 2
        }
      },
      "additionalProperties": false
    },
    "reporters": {
      "type": "array",
      "description": "Specifies the reporters to use during test execution. Each reporter can be a string representing its name, or a tuple containing the name and an options object. Built-in reporters include 'default', 'verbose', 'dots', 'json', 'junit', 'tap', 'tap-flat', and 'html'. You can also provide a path to a custom reporter.",
      "items": {
        "oneOf": [
          {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "enum": ["default", "verbose", "dots", "json", "junit", "tap", "tap-flat", "html"]
              }
            ]
          },
          {
            "type": "array",
            "minItems": 1,
            "maxItems": 2,
            "items": [
              {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "enum": [
                      "default",
                      "verbose",
                      "dots",
                      "json",
                      "junit",
                      "tap",
                      "tap-flat",
                      "html"
                    ]
                  }
                ]
              },
              {
                "type": "object"
              }
            ]
          }
        ]
      }
    },
    "outputFile": {
      "type": "string",
      "description": "Specifies a file path for the test report, applying only to the first reporter. To configure output files for multiple reporters, use the tuple format `['reporter-name', { outputFile: '...' }]` within the `reporters` option. When not provided, output is written to the console."
    },
    "providersFile": {
      "type": "string",
      "description": "Specifies the path to a TypeScript file that provides an array of Angular providers for the test environment. The file must contain a default export of the provider array.",
      "minLength": 1
    },
    "setupFiles": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "A list of paths to global setup files that are executed before the test files. The application's polyfills and the Angular TestBed are always initialized before these files."
    },
    "progress": {
      "type": "boolean",
      "description": "Shows build progress information in the console. Defaults to the `progress` setting of the specified `buildTarget`."
    },
    "listTests": {
      "type": "boolean",
      "description": "Lists all discovered test files and exits the process without building or executing the tests.",
      "default": false
    },
    "dumpVirtualFiles": {
      "type": "boolean",
      "description": "Dumps build output files to the `.angular/cache` directory for debugging purposes.",
      "default": false,
      "visible": false
    }
  },
  "additionalProperties": false,
  "required": []
}
