# Options

Options can be specified in one of 3 ways:

- An argument passed to your test process, e.g. `--skipTypes` or `--benchPercentThreshold 10`
- An environment variable with an `ATTEST_` prefix, e.g. `ATTEST_skipTypes=1` or `ATTEST_benchPercentThreshold=10`
- Passed as an option to attest's `setup` function, e.g.:

```ts title="setupVitest.ts"
import * as attest from "@ark/attest"

export const setup = () =>
	attest.setup({
		skipTypes: true,
		benchPercentThreshold: 10
	})
```

Here are the current defaults for all available options. Please note, some of these are experimental and subject to change:

```ts
export const getDefaultAttestConfig = (): BaseAttestConfig => ({
	tsconfig:
		existsSync(fromCwd("tsconfig.json")) ? fromCwd("tsconfig.json") : undefined,
	compilerOptions: {},
	attestAliases: ["attest", "attestInternal"],
	failOnMissingSnapshots: "CI" in process.env,
	updateSnapshots: false,
	skipTypes: false,
	skipInlineInstantiations: false,
	benchPercentThreshold: 20,
	benchErrorOnThresholdExceeded: true,
	filter: undefined,
	testDeclarationAliases: ["bench", "it", "test"],
	formatCmd: `npm exec --no -- prettier --write`,
	shouldFormat: true,
	typeToStringFormat: {}
})
```

### skipTypes

`skipTypes` is extremely useful for iterating quickly during development without having to typecheck your project to test runtime logic.

When this setting is enabled, setup will skip type checking and all assertions requiring type information will be skipped.

You likely want two scripts, one for running tests with types and one for tests without:

```json title="package.json"
"test": "ATTEST_skipTypes=1 vitest run",
"testWithTypes": "vitest run",
```

Our recommendation is to use `test` when:

- Only wanting to test runtime logic during development
- Running tests in watch mode or via VSCode's Test Explorer

Use `testWithTypes` when:

- You've made changes to your types and want to recheck your type-level assertions
- You're running your tests in CI

### typeToStringFormat

A set of [`prettier.Options`](https://prettier.io/docs/en/options.html) overrides that apply specifically `type.toString` formatting.

Any options you provide will override the defaults, which are as follows:

```json
{
	"semi": false,
	// note this print width is optimized for type serialization, not general code
	"printWidth": 60,
	"trailingComma": "none",
	"parser": "typescript"
}
```

The easiest way to provide overrides is to the `setup` function, but they can also be provided as a JSON serialized string either passed to a `--typeToStringFormat` CLI flag or set as the value of `ATTEST_typeToStringFormat` on `process.env`.
