
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
testcafe-reporter-custom
Advanced tools
TestCafe reporter that allows you to provide your own logic
This is the custom reporter plugin for TestCafe.
npm install testcafe-reporter-custom
When you run tests from the command line, specify the reporter name by using the --reporter
option:
testcafe chrome 'path/to/test/file.js' --reporter custom
When you use API, pass the reporter name to the reporter()
method:
testCafe
.createRunner()
.src('path/to/test/file.js')
.browsers('chrome')
.reporter('custom') // <-
.run();
After that you can define your custom logic in reporter/index.js
file.
It can be defined as an object or factory function.
For example:
module.exports = function () {
return {
async reportTaskStart(/* startTime, userAgents, testCount */) {
throw new Error('Not implemented');
},
async reportFixtureStart(/* name, path, meta */) {
throw new Error('Not implemented');
},
async reportTestStart(/* name, meta */) {
// NOTE: This method is optional.
},
async reportTestDone(/* name, testRunInfo, meta */) {
throw new Error('Not implemented');
},
async reportTaskDone(/* endTime, passed, warnings, result */) {
throw new Error('Not implemented');
}
};
}
API is completely the same as for regular reporter.
Reporter can be configured using reporter.config.js
file, which should be placed in a project root folder.
module.exports = {
path: 'reporter/main.js'
};
Possible options are presented in the table below.
Option | Default Value | Description |
---|---|---|
path | 'reporter/index.js' | Path to your reporter. |
moduleType | 'commonjs' | Whether your reporter uses CommonJS or ES Modules. Possible values are commonjs and module . |
tsNodePath | 'node_modules/ts-node' | Path to your ts-node installation (only used for *.ts files). |
tsOptions | undefined | ts-node options (only used for *.ts files). |
In order to use TypeScript with this reporter, at least ts-node
and typescript
packages should be installed.
npm install --save-dev ts-node typescript
After that you need to create reporter.config.ts
file and specify path
to your reporter.
module.exports = {
path: 'reporter/index.ts'
};
As testcafe-reporter-custom
use ts-node
in order to execute TypeScript files, all it's rules are applied.
If you want to provide additional ts-node
options, you can use tsOptions
in the reporter configuration file.
For example, you can specify custom tsconfig
file using the following configuration:
module.exports = {
path: 'reporter/index.ts',
tsOptions: {
project: 'tsconfig.reporter.json'
}
};
There is a couple of usage examples available in this repository:
FAQs
TestCafe reporter that allows you to provide your own logic
We found that testcafe-reporter-custom demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.