https://pulumi.com logo
#automation-api
Title
# automation-api
v

victorious-tomato-90057

05/05/2022, 2:12 AM
Hi forks, is it possible to 'restart' the pulumi runtime after a test in the
after
hook during the tests?
l

little-cartoon-10569

05/05/2022, 3:07 AM
Are you talking about unit tests in something like Mocha or Jest? If you call setMocks() during beforeEach(), or anywhere that's run before each it(), then you achieve that.
v

victorious-tomato-90057

05/05/2022, 3:10 AM
Not the mock part. I have codes for the transforms which touch the runtime, it set stuff in the runtime for next test suit. Just wonder if there is a way to ‘reset’ or clean the runtime to default.
l

little-cartoon-10569

05/05/2022, 3:11 AM
Ah yes. I have (very, very old....) tests for transforms, I'll see if I do that...
🙏 1
My solution was to create a runtime for each it(), describe() or context() that requires it. Here's a simple example.
runInPulumiStack()
being the magic at work here.
v

victorious-tomato-90057

05/05/2022, 3:35 AM
Thanks very much. Let me have a try.
5 Views