little-cartoon-10569
06/17/2020, 4:29 AMpulumi.runtime.setMocks
) supposed to be cleared manually? I'm writing test modules and expecting the Pulumi runtime to know about the resources created during calls to Mocha before()
and similar code, and the resources created during the test. Nothing else should exist. But I'm finding all resources there. Not just ones in the same file, but ones in completely unrelated files that are being run during the same call to npm run test
. Do I need to clear the fakes ("mocks") out? Or do I need to wrap every test module in a call to runInPulumiStack()
?little-cartoon-10569
06/17/2020, 6:49 AMrunInPulumiStack()
can't wrap setMocks()
. I can't see a way to clear the fakes set up in setMocks()
. I might have to change npm run test
to run mocha once per .spec.ts file, instead of once.little-cartoon-10569
06/17/2020, 6:53 AMlittle-cartoon-10569
06/17/2020, 10:35 PMsetMocks
is visible across all test files and each call to setMocks
blats whatever was already in there.
For example, if in a.spec.ts I call pulumi.runtime.setMocks({ newResource: new_resource_a; call: call_a; })
and in b.spec.ts I do same except with new_resource_b
and call_b
, then the tests in a.spec.ts see the "correct" resources but they've been processed by new_resource_b
and call_b
.
I need to scope Pulumi (or at least its runtime) to a single file, since the implementations of those faking functions are contradictory and can't be merged.little-cartoon-10569
06/17/2020, 10:44 PMoptions
in runtime/settings.ts. I'm a JS/TS beginner, I don't know what to search for to figure out how to achieve that 😞little-cartoon-10569
06/18/2020, 3:24 AM