-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression: Custom reporter not working for multiple test files execution #1205
Comments
@mdharamadas - How is the custom reporter broken? What is the command line or settings you're using? What happens in 0.8.18? What happens in 0.9.0? |
@bitwiseman pls see the required details below...
In
When I run single test file using following command line, I see that it prints 'custom reporting' in the test execution logs. But, when I run all the test files using following command line, I DO NOT see 'custom reporting' printed in the test execution logs. Both of these commands work as expected (prints 'custom reporting' in logs) with Nightwatch v0.8.18. Same behaviour if I have separate Let me know if you need any further details or if anythings not clear. |
@beatfactor can you take a look at this one pls? thanks! |
Same issue for me, that'd help a lot! Thanks! |
I can confirm this is still an issue on 0.9.16 |
+1 |
Was browsing through issues to find another issue and stumbled upon this. Guess mine is a duplicate, but I turned it into a feature request instead of a bug report as I was not aware this is a regression. |
We have digged into the code a little and found out the following:
The correct solution in my opinion would be, not to call the reporter at all from the test-workers. Instead the worker should report back the results to the main-process. The main-process should merge the results and then call the reporter. |
+1. Able to reproduce in 0.9.19 |
I am able to write to a file from custom reporter but console.log doesn't work if custom reporter is defined in globalsModule.js. |
Hi @beatfactor can you give an update on this? |
@aberonni have you tested it in the latest v1.0.6? |
@beatfactor reproduced also with v1.0.6 You can see the output with only 1 test result instead of 2 here, and reproduce in this repo. |
@beatfactor could you add the Also let me know when the latest code is pushed and I will test again against the latest code. |
Has anyone found a workaround for the interim? |
@lreading we have a workaround in place that uses the global This is a rough example (might need some readaption to work correctly). const filePath = 'some/path/to.json';
afterEach: (client, done) => {
const { currentTest } = client;
let results;
try {
results = require(filePath);
} catch (e) {
results = {};
}
const data = {
name: currentTest.module,
success: currentTest.results.errors === 0 && currentTest.results.failed === 0,
errors: Object.entries(currentTest.results.testcases).reduce((errors, [testcaseName, testcase]) => {
if (testcase.errors !== 0 || testcase.failed !== 0) {
errors.push({
testcase: testcaseName,
assertions: testcase.assertions
});
}
return errors;
}, [])
};
results[data.name] = data;
try {
fs.writeFileSync(filePath, JSON.stringify(results), "utf8");
} catch (e) {
console.log(`An error occured while saving ${filePath}:`);
console.log(e);
}
done()
}; |
Thanks for the detailed response! |
This issue has been automatically marked as stale because it has not had any recent activity. |
Not stale |
@beatfactor looks like this can be closed now that the PR has been merged and released |
Still experiencing this on v1.3.2. The results object that is passed into the |
This seems broken since v0.9.0 release. Custom reporter works with just one test file execution but doesn't work when executing a set of test files. This is for both approaches,
--reporter
andreporter
method in externalglobals
file.I tried with v0.8.18 and it works fine for any test executions.
Its surprising that no one even reported this issue (does that mean nobody is using this feature? )
The text was updated successfully, but these errors were encountered: