What needs to be done:
- Change Hooks
In the version before 3.0.0 we had a single file located in the ./hook
directory.
Example of hook.js
:
const { Before, After } = require('kakunin');
Before(() => {
console.log('If you can see this in console then hook is working properly.');
});
After(() => {
console.log('Console log after the scenario');
});
Currently, the interface to set priorities has been added. So we can control if the hook FirstExample
will be executed before SecondExample
.
Example of first-example.hook.js
:
const { hookHandlers, Before } = require('kakunin');
class FirstExampleHook {
initializeHook() {
Before(() => {
console.log('First example hook');
});
}
getPriority() {
return 990;
}
}
hookHandlers.addHook(new FirstExampleHook());