{
    "title": "JSON schema for Chutzpah test runner settings files",
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "additionalProperties": true,
    "definitions": {
        "referenceSettings": {
            "properties": {
                "Path": {
                    "description": "The path to either a file or a folder. If given a folder, it will be scanned recursively. This path can be relative to the location of the chutzpah.json file.",
                    "type": "string"
                },
                "Include": {
                    "description": "This is an optional include glob pattern. This is used when the Path is a folder. Only files matching the Include pattern will be added.",
                    "type": "string"
                },
                "Exclude": {
                    "description": "This is an optional include glob pattern. This is used when the Path is a folder. Only files matching the Include pattern will be added.",
                    "type": "string"
                },
                "IncludeInTestHarness": {
                    "description": "This determines if the reference should be injected into the test harness. When referencing files like .d.ts or files that you plan to load using require.js you should set this to false. Defaults to true.",
                    "type": "boolean",
                    "default": true
                },
                "IsTestFrameworkFile": {
                    "description": "Indicated that this references should be placed directly after the test framework files in the test harness. This ensures that this file is injected into the test harness before almost all other files. Defaults to false.",
                    "type": "boolean",
                    "default": false
                }
            }
        },
        "testSettings": {
            "properties": {
                "Path": {
                    "description": "The path to either a file or a folder. If given a folder, it will be scanned recursively. This path can be relative to the location of the chutzpah.json file.",
                    "type": "string"
                },
                "Include": {
                    "description": "This is an optional include glob pattern. This is used when the Path is a folder. Only files matching the Include pattern will be added.",
                    "type": "string"
                },
                "Exclude": {
                    "description": "This is an optional include glob pattern. This is used when the Path is a folder. Only files matching the Include pattern will be added.",
                    "type": "string"
                }
            }
        },
        "compileSettings": {
            "description": "his setting lets you describe in the Chutzpah.json file how to execute a command which can compile your source files to .js files. You tell Chutzpah what to execute and some information about what your executable does (like where to find the generated .js files). Then after running the executable Chutzpah can associate each source file with each output file to still give the nice behavior of mapping tests back to their original files.",
            "type": "object",
            "properties": {
                "Extensions": {
                    "description": "The extensions of the files which are getting compiled (e.g. .ts).",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "ExtensionsWithNoOutput": {
                    "description": "The extensions of files which take part in compile but have no build output. This is used for cases like TypeScript declaration files which share a .ts extension. They have .d.ts extension and are part of compilation but have no output. You must tell Chutzpah about these if you want the SkipIfUnchanged setting to work. Otherwise Chutzpah will think these are missing output.",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "SourceDirectory": {
                    "description": "The root directory where all the sources the command compiles are below. This lets Chutzpah know where in the out dir it should find each reference file.",
                    "type": "string"
                },
                "OutDirectory": {
                    "description": "The directory where the compiled files are output to.",
                    "type": "string"
                },
                "WorkingDirectory": {
                    "description": "This is the working directory of the process which executes the command.",
                    "type": "string"
                },
                "Executable": {
                    "description": "The path to an executable which Chutzpah executes to perform the batch compilation. Chutzpah will try to resolve the path relative to the settings directory. But if can\u2019t find the file there you must give it a full path.",
                    "type": [
                        "string",
                        "null"
                    ],
                    "default": null
                },
                "Arguments": {
                    "description": "The arguments to pass to the command.",
                    "type": [
                        "string",
                        "null"
                    ],
                    "default": null
                },
                "Timeout": {
                    "description": "How long to wait for compile to finish in milliseconds?",
                    "type": "integer",
                    "default": 30000
                },
                "SkipIfUnchanged": {
                    "description": "Skips the execution if all files Chutzpah knows about are older than all of the output files. This is defaulted to true but if you hit issues since it is possible Chutzpah might not know about all the files your compilation is using then you can turn this off. Ideally you should tell Chutzpah about these files using the references and tests settings since this setting helps Chutzpah not need to even invoke the executable if it figures out it\u2019s not needed.",
                    "type": "boolean",
                    "default": true
                },
                "Mode": {
                    "description": "Determines how this compile setting is used. By default it is in Executable mode where it will require you provide an executable which Chutzpah will run if it sees it finds missing .js for input file. If you set this to External then Chutzpah will ignore the Executable, Arguments settings and assume you have some external process which is compiling. In this case Chutzpah will use the SourceDirectory and OutDirectory options to try to find your .js files for the input files. If it can't find them it will trace an error but still attempt to proceed.",
                    "type": "string",
                    "enum": [
                        "Executable",
                        "External"
                    ],
                    "default": "Executable"
                }
            }
        }
    },
    "properties": {
        "Framework": {
            "description": "Determines what testing framework to use. This will override the other detection methods.",
            "type": "string",
            "enum": [
                "qunit",
                "jasmine",
                "mocha"
            ]
        },
        "FrameworkVersion": {
            "description": "Tells Chutzpah if it should use a different version of on of the test frameworks than the default one. Currently, the only framework this works for is Jasmine. As of the 3.1.0 release Chutzpah default to Jasmine 2.0 but if you want to use the 1.0 line for Jasmine still pass '1' for FrameworkVersion.",
            "type": "string"
        },
        "References": {
            "description": "The references setting allows you to specify which files/folders to use/scan to find references. This is useful since it replaces the need to the ///<reference comments.",
            "type": "array",
            "items": {
                "$ref": "#/definitions/referenceSettings"
            }
        },
        "Tests": {
            "description": "The references setting allows you to specify which files/folders to use/scan to find references. This is useful since it replaces the need to the ///<reference comments.",
            "type": "array",
            "items": {
                "$ref": "#/definitions/testSettings"
            }
        },
        "Compile": {
            "$ref": "#/definitions/compileSettings"
        },
        "TestFileTimeout": {
            "description": "The time to wait for tests in a file to finish in milliseconds.",
            "type": "integer"
        },
        "TestHarnessLocationMode": {
            "description": "Determines where to place the generated html test harness files. The default mode is TestFileAdjacent which means the harness is placed in the same directory as the test file. SettingsFileAdjacent means it is placed in the same directory as the chutzpah.json file. Custom mode lets you specify a custom path to the directory.",
            "type": "string",
            "enum": [
                "TestFileAdjacent",
                "SettingsFileAdjacent",
                "Custom"
            ]
        },
        "TestHarnessReferenceMode": {
            "type": "string",
            "enum": [
                "Normal",
                "AMD"
            ]
        },
        "TestHarnessDirectory": {
            "description": "When TestHarnessLocationMode is set to Custom this is either the relative or absolute path to the directory where to place the test harness.",
            "type": "string"
        },
        "RootReferencePathMode": {
            "description": "This property determines what directory a rooted reference path refers to.",
            "type": "string",
            "enum": [
                "DriveRoot",
                "SettingsFileDirectory"
            ],
            "default": "DriveRoot"
        },
        "EnableCodeCoverage": {
            "description": "If true, forces code coverage to run always. If null or not not set, allows code coverage to run if invoked using test adapter, command line or context menu options (default). If false, forces code coverage to never run.",
            "type": [
                "boolean",
                "null"
            ]
        },
        "CodeCoverageIncludes": {
            "description": "The collection code coverage file patterns to include in coverage. These are in glob format. If you specify none all files are included.",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "CodeCoverageExcludes": {
            "description": "The collection code coverage file patterns to exclude in coverage. These are in glob format. If you specify none no files are excluded.",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "CustomTestHarnessPath": {
            "description": "The CustomTestHarnessPath setting allows you to override the default template Chutzpah uses for the HTML test harness. This is an advanced feature which should only be used as a last resort.",
            "type": "string"
        },
        "CoffeeScriptBareMode": {
            "description": "The CoffeeScriptBareMode indicates if you want CoffeeScript compilation to output scripts in bare mode or not. In bare mode CoffeeScript won\u2019t wrap the generated JavaScript in a function to protect the scope.",
            "type": "boolean",
            "default": true
        },
        "AMDBasePath": {
            "description": "Lets you configure Chutzpah to work in with RequireJS when you are setting a baseurl in your Require.js config. This should point to the same location.",
            "type": "string"
        },
        "TestPattern": {
            "description": "When Chutzpah reports test results it also tells you what line they are on. The way this is accomplished is by having a regex for each testing framework which describes where to find the names of your tests.",
            "type": "string",
            "format": "regex"
        },
        "TypeScriptCodeGenTarget": {
            "type": "string",
            "enum": [
                "ES3",
                "ES5"
            ]
        },
        "TypeScriptModuleKind": {
            "type": "string",
            "enum": [
                "CommonJS",
                "AMD"
            ]
        }
    }
}