Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

126
Views
Add information to Mocha it function so I can use them in reporter

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

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!