Example configuration in CodeceptJS config:
plugins: {
elastic: {
require: './src/plugins/ElasticReporter.js',
enabled: false, // Set this to "true" if you want to activate plugin always. I prefer on-demand activation on command line with "-p elastic", thatswhy it is "false" in this Gist.
protocol: 'https',
server: 'MY_DNS_FOR_ELASTICSEARCH_SERVER', // <- REPLACE VALUE. Example value: 'elastic.example.org'
port: 9200,
index: `MY_NAME_OF_INDEX`, // <- REPLACE VALUE. Example value: 'qa-e2etests'
// Optional: Adjust configuration of custom fields to your needs.
// Every key/value pair you add here, will be added as a field in Elasticsearch index.
customFields: {
url: 'https://www.example.com',
environment: process.env.ENVIRONMENT,
testrun: 'Run-' + new Date(new Date().getTime() - (new Date().getTimezoneOffset() * 60000)).toISOString().slice(0, -5),
jenkinsJob: process.env.JOB_NAME
}
}
}
I see. I was not aware
axios
is around. That makes the HTTP request is easier to read and maintain for sure.On the other hand you then build up some dependency that I will break once CodeceptJS decides to drop
axios
dependency.