diff --git a/README.md b/README.md index 408c2ef..43d2518 100755 --- a/README.md +++ b/README.md @@ -76,10 +76,11 @@ module.exports = { ] ... ``` - +You can disable it adding `"enabled": false` as an configuration. It's possible by using environment variables, it's important to mention that environment variables has precedence over `package.json` definition. ```shell +$ export RP_ENABLED=false $ export RP_TOKEN=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX $ export RP_PROJECT_NAME=MY_AWESOME_PROJECT $ export RP_ENDPOINT=MY_RP_ENDPOINT diff --git a/index.js b/index.js index 6cbd07d..391b529 100644 --- a/index.js +++ b/index.js @@ -41,6 +41,7 @@ class JestReportPortal { constructor(globalConfig, options) { const agentInfo = getAgentInfo(); this.reportOptions = getClientInitObject(getOptions.options(options)); + if(this.reportOptions.enabled ==='false') return {invalid:true}; this.client = new RPClient(this.reportOptions, agentInfo); this.tempSuiteIds = new Map(); this.tempTestIds = new Map(); diff --git a/utils/objectUtils.js b/utils/objectUtils.js index 6e61e29..3c23b87 100644 --- a/utils/objectUtils.js +++ b/utils/objectUtils.js @@ -73,6 +73,7 @@ const getClientInitObject = (options = {}) => { }); return { + enabled: process.env.RP_ENABLED || options.enabled, token: process.env.RP_TOKEN || options.token, endpoint: process.env.RP_ENDPOINT || options.endpoint, launch: process.env.RP_LAUNCH || options.launch || 'Unit Tests',