I want to create a special reporter to share with all our projects (and maybe later share to the community I hope). The goal is simply to generate, from the tests, a reporter made for xray.
I would like to be able to add informations to each test and retrieve these informations in the reporter.
In my mind, it would be something like this
@specialInformation(one = 1, two = 2)
it('is a test with informations', () => {
//blablabla test
});
And then, in the reporter
runner.on(EVENT_TEST_END, function (test: Mocha.Test) {
console.log(test.somewhere.one); // will log 1
console.log(test.somewhere.two); // will log 2
});
For now i've managed to add the informations in the it title and to extract them with regexp, but I don't really like it...
For what I've seen, decorators seems to be only for classes or method definition and not method usage...
Has someone any idea how to manage that ? Thanks