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');
    }