For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /config/test/env.md.
close
  • English
  • env

    • Type: Partial<NodeJS.ProcessEnv>
    • Default: undefined

    Custom environment variables available on process.env during tests.

    rstest.config.ts
    import { defineConfig } from '@rstest/core';
    
    export default defineConfig({
      env: {
        PRINT_LOGGER: 'true',
      },
    });

    After setting the above configuration, you can access the PRINT_LOGGER variable in your tests:

    index.test.ts
    import { describe, it } from '@rstest/core';
    
    if (process.env.PRINT_LOGGER === 'true') {
      console.log('PRINT_LOGGER is enabled');
    }