symfony test env VS composer require –dev

  composer-php, environment, symfony

I was configuring environment of a symfony 5 project, and while testing the test environment (APP_ENV = test) there was an exception because it couldn’t find the web-profiler bundle. Which is normal since it’s installed by composer with a require –dev.
Which is kinda a dilemma since even though I currently don’t need this bundle in a test env, I technically might.

Worse : I need the doctrine fixture bundle in dev and in test; but to have it in test too, I’d have to "remove the –dev" option, therefore having it in production too, which is pretty bad.

So I’m wondering what is the common way to handle that issue ? I guess it’s a common problem.

Thank you.

Source: Symfony Questions