How to get module option from test command in environment config


#1

When running tests using a command such as ember test --module="Acceptance | example" , how could I capture the module option within the environment.js config file?

The aim here is to pass a flag indicating the acceptance test module into the application instance when testing. The flag will simply be used in the application to check whether to execute a block of code.

One idea I’ve had is that perhaps I can pass a flag into the application instance from the beforeEach hook in acceptance test modules. This would be better because I wouldn’t have to include the --module option in the test command, and I’d be able to run all my tests at once. I’m not sure this is possible or how to do this but it’s currently my best start.


#2

What are you really trying to achieve? What does the code block you’re trying to guard actually do?

(I’m asking because there is almost certainly a better solution than making your application know about which test happens to be running.)