Skip to content
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

Add RP_ENABLED and enabled configuration possibility and fix documentation #114

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain this line?
What is "invalid: true" here, does it have some specification?

this.client = new RPClient(this.reportOptions, agentInfo);
this.tempSuiteIds = new Map();
this.tempTestIds = new Map();
Expand Down
1 change: 1 addition & 0 deletions utils/objectUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down