--- title: provide | Config outline: deep --- # provide - **Type:** `Partial` Define values that can be accessed inside your tests using `inject` method. :::code-group ```ts [vitest.config.js] import { defineConfig } from 'vitest/config' export default defineConfig({ test: { provide: { API_KEY: '123', }, }, }) ``` ```ts [api.test.js] import { expect, inject, test } from 'vitest' test('api key is defined', () => { expect(inject('API_KEY')).toBe('123') }) ``` ::: ::: warning Properties have to be strings and values need to be [serializable](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types) because this object will be transferred between different processes. ::: ::: tip If you are using TypeScript, you will need to augment `ProvidedContext` type for type safe access: ```ts [vitest.shims.d.ts] declare module 'vitest' { export interface ProvidedContext { API_KEY: string } } // mark this file as a module so augmentation works correctly export {} ``` :::