@0x/contracts-test-utils
: Make blockchainTests()
automatically call blockchainLifecycle.startAsync()
and blockchainLifecycle.revertAsync()
in a before()
and after()
directive.
This commit is contained in:
@@ -80,7 +80,18 @@ function defineBlockchainSuite<T>(
|
||||
describeCall: Mocha.ContextDefinitionCallback<T>,
|
||||
): T {
|
||||
return describeCall(description, function(this: Mocha.ISuiteCallbackContext): void {
|
||||
callback.call(this, BlockchainTestsEnvironment.create());
|
||||
const env = BlockchainTestsEnvironment.create();
|
||||
before(
|
||||
async (): Promise<void> => {
|
||||
return env.blockchainLifecycle.startAsync();
|
||||
},
|
||||
);
|
||||
before(
|
||||
async (): Promise<void> => {
|
||||
return env.blockchainLifecycle.revertAsync();
|
||||
},
|
||||
);
|
||||
callback.call(this, env);
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user