Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

133
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda