The BEFORE_FILE_READ event is triggered synchronously before a test file is read and parsed. It is available in both the master and worker processes. This event is primarily used to inject custom controllers (helpers) into the global testplane object, making them available for use within your test files.
To use this, subscribe to testplane.events.BEFORE_FILE_READ and use the provided testParser object to register a controller via setController.
testplane.on(testplane.events.BEFORE_FILE_READ, ({ file, testplane, testParser }) => {
testParser.setController('logger', {
log: function(prefix) {
console.log(`${prefix}: just parsed ${this.fullTitle()} from ${file} for browser ${this.browserId}`);
}
});
});