Instead of calling this in the test, can you split it into a separate file and add that file to 'onPrepare' in the configuration?