testcafe
testcafe copied to clipboard
Add a separate property for the reporter factory function
Seems it's not possible to use local reporter using config file now. Its can be wery useful feature, especially as is possible with js interface.
{
reporter: [
{
'name/path': 'test/reporter.ts',
'output': './e2e_report.xml'
}
}
This functionality will be available after we support the JS configuration file. You will be able to load your reporter using the require
method. Please track the following issue to be notified of our progress: https://github.com/DevExpress/testcafe/issues/5109
Hi! seems js configuration already implemented, is there any guide which shows how can i use my local reporter?
Hi @mokone91,
You can specify your local reporter in the JS configuration file in the following way:
.testcaferc.js
const reporter = require('./reporter');
module.exports = {
reporter,
browsers: 'chrome',
src: ['test.js']
}
Hi! So i have implemented it using next snippet:
const customReporter = require('./customReporter');
module.exports = {
...
reporter: [
{
name: 'spec'
},
{
name: customReporter,
output: './reports/e2e_report.xml'
}
],
}
and seems it works as expected, the only point here - I passing reporter as name 🙃
@mokone91
It occurred due to the parsing reporting parameters algorithm. It's not part of a public API and can be changed at any time. Please, use the approach from the https://github.com/DevExpress/testcafe/issues/6286#issuecomment-979916850.
@mokone91
It occurred due to the parsing reporting parameters algorithm. It's not part of a public API and can be changed at any time. Please, use the approach from the #6286 (comment).
Hi @miherlosev
But how then I can select multiple reporters and configure outputPath for custom?
Hi @mokone91
We discussed this with @AndreyBelym one more time and decided the following:
- We should make a separate property for a reporter if it's specified as a factory function.
const customReporter = require('./customReporter');
module.exports = {
...
reporter: [
{
reporter: customReporter, <--- new property
output: './reports/e2e_report.xml'
}
],
}
- The
name
property should accept only thestring
name of a reporter. We should raise a warning if the value of the another type is accepted. - We recommend using the
name
property until the new property is implemented.
Since there is a workaround (using the name
property) and the issue is not popular among TestCafe users, we decided to close it.