cue.dev/x/npmjs/ava@v0.4.0

schema.cue raw

  1package ava
  2
  3import "strings"
  4
  5// AVA Config Schema
  6//
  7// Configuration Schema for the JavaScript test runner AVA
  8#Schema: {
  9	@jsonschema(schema="http://json-schema.org/draft-07/schema#")
 10	@jsonschema(id="https://json.schemastore.org/ava.json")
 11	close({
 12		"files"?:            #."array-of-paths"
 13		"ignoredByWatcher"?: #."array-of-paths"
 14		"match"?:            #."array-of-paths"
 15
 16		// Defaults to `true` to cache compiled files under `node_modules/.cache/ava.`
 17		// If `false`, files are cached in a temporary directory instead
 18		"cache"?: bool
 19
 20		// Max number of test files running at the same time (default: CPU cores)
 21		"concurrency"?: number
 22
 23		// Use worker threads to run tests (enabled by default). If `false`, tests will
 24		// run in child processes
 25		"workerThreads"?: bool
 26
 27		// Stop running further tests once a test fails
 28		"failFast"?: bool
 29
 30		// If `false`, does not fail a test if it doesn't run assertions
 31		"failWithoutAssertions"?: bool
 32
 33		// environment variables
 34		//
 35		// Specifies environment variables to be made available to the tests. The
 36		// environment variables defined here override the ones from `process.env`
 37		"environmentVariables"?: [string]: string
 38
 39		// if `true`, prevents parallel execution of tests within a file
 40		"serial"?: bool
 41
 42		// If `true`, enables the TAP reporter
 43		"tap"?: bool
 44
 45		// If `true`, enables verbose output (though currently non-verbose output is not supported)
 46		"verbose"?:     bool
 47		"snapshotDir"?: #path
 48
 49		// Extensions of test files. Setting this overrides the default `["cjs", "mjs",
 50		// "js"]` value, so make sure to include those extensions in the list.
 51		// Experimentally you can configure how files are loaded
 52		"extensions"?: matchN(>=1, [
 53			#."array-of-strings",
 54			{
 55				{[=~"^(c|m)?js$"]: true}
 56				{[!~"^(c|m)?js$" & !~"^()$"]: "commonjs" | "module"}
 57			}
 58		])
 59		"require"?: #."array-of-paths"
 60
 61		// Timeouts in AVA behave differently than in other test frameworks. AVA resets
 62		// a timer after each test, forcing tests to quit if no new test results were
 63		// received within the specified timeout. This can be used to handle stalled
 64		// tests. See our timeout documentation for more options
 65		"timeout"?:       matchN(>=1, [>=0, =~"^(\\d+)(s|m)$"])
 66		"nodeArguments"?: #."array-of-strings"
 67
 68		// If `false`, disable parallel builds (default: `true`)
 69		"utilizeParallelBuilds"?: bool
 70
 71		// configuration
 72		//
 73		// Configures @ava/typescript for projects that precompile TypeScript.
 74		// Alternatively, you can use `ts-node` to do live testing without transpiling,
 75		// in which case you shouldn't use the `typescript` property
 76		"typescript"?: {
 77			"extensions"?: #."array-of-paths"
 78
 79			// paths
 80			//
 81			// AVA searches your entire project for `*.js`, `*.cjs`, `*.mjs` and `*.ts`
 82			// files (or other extensions you've configured). It will ignore such files
 83			// found in the `rewritePaths` targets (e.g. `build/`). If you use more
 84			// specific paths, for instance `build/main/`, you may need to change AVA's
 85			// `files` configuration to ignore other directories. Paths are relative to
 86			// your project directory
 87			"rewritePaths"?: {
 88				{[=~"/$"]: =~"/$"}
 89				...
 90			}
 91
 92			// If `false`, AVA will assume you have already compiled your project. If set to
 93			// `'tsc'`, AVA will run the TypeScript compiler before running your tests.
 94			// This can be inefficient when using AVA in watch mode
 95			"compile"?: false | "tsc"
 96			...
 97		}
 98	})
 99
100	#: "array-of-paths": [...#path]
101
102	#: "array-of-strings": [...string]
103
104	#path: strings.MinRunes(1)
105}