In my unit tests, I want to be able to make use of...
# typescript
r
In my unit tests, I want to be able to make use of the config values for a given stack, so that I can verify that, for example, resources are deployed to the NorthEurope region in Azure even though that’s only specified in my stack config files and not in my Pulumi app. How can I go about doing this? I suspect the config-loading behaviour is overridden by the
setMocks()
call, but I haven’t verified that yet.
g
Unfortunately, we don't currently support Config in tests. This is being tracked at https://github.com/pulumi/pulumi/issues/4472.
Config is available in Policies via Crossguard - https://www.pulumi.com/docs/get-started/crossguard/.
r
Ok, thanks @gentle-diamond-70147. Seems like there’s a possible workaround with the
PULUMI_CONFIG
environment variable, or am I misunderstanding that?
g
That's a good way to mock your configuration for the purposes of running the tests.
👍 1