CodeceptJS get test file on events


#1

Hello all,

I’m writing a framework using CodeceptJS and I’m wondering if it’s possible to get the file that is running the test on the ‘event.test.failed’ event.
On the documentation (https://codecept.io/hooks/#test-object) it says that I can access to file, but on my code it says undefined.

Any idea/help, please?

Thanks
Alex


#2

File should be available.

 event.dispatcher.on(event.test.failed, test => {
    debug(`event.test.failed - ${test.file}`);
  });

#3

Hi David,

Thanks for your reply.
I’m afraid is not working. I replaced my code for your line, but still undefined

event.dispatcher.on(event.test.failed, test => {
    console.log(`event.test.failed - ${test.file}`);
  });

event.test.failed - undefined

Any idea why?
I am using codeceptjs 1.4.5
Regards,
Alex