> For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt.

# env

- **类型：** `Partial<NodeJS.ProcessEnv>`
- **默认值：** `undefined`

自定义环境变量，在测试过程中可以通过 `process.env` 访问。

```ts title="rstest.config.ts"
import { defineConfig } from '@rstest/core';

export default defineConfig({
  env: {
    PRINT_LOGGER: 'true',
  },
});
```

在设置上述配置后，现在，你可以在测试中访问 `PRINT_LOGGER` 变量：

```ts title="index.test.ts"
import { describe, it } from '@rstest/core';

if (process.env.PRINT_LOGGER === 'true') {
  console.log('PRINT_LOGGER is enabled');
}
```
