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