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

customInfos - doesn't work when a json string is assigned to JEST_HTML_REPORTERS_CUSTOM_INFOS #96

Closed
anandcbe14 opened this issue Jan 24, 2021 · 2 comments · Fixed by #109
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@anandcbe14
Copy link

Describe the bug
customInfos - - doesn't work when the Key/Value Pairs object is stringified and assigned to process.env.JEST_HTML_REPORTERS_CUSTOM_INFOS in the globalSetup

To Reproduce
Steps to reproduce the behavior:

  1. In the js for globalSetup, create a json object and assign it - viz.
const mycustInfo = { 'Environment':'dev',  'Browser':'chrome'  };
process.env.JEST_HTML_REPORTERS_CUSTOM_INFOS = JSON.stringify(mycustInfo);

and specify this in package.json:
"customInfos" : "JEST_HTML_REPORTERS_CUSTOM_INFOS"

  1. Once the test is executed, the following warning message is displayed in console log:
    the value of Custom info env must be a json string point to an Object

  2. However, when the customInfos is specified directly in package json as below, it works as expected:
    ``"customInfos" : [{ title: "Environment", value: "dev" }, { title: "Browser", value: "chrome" }]`

Expected behavior
Dynamically constructing the customInfos object as specified in #1 is expected to work as in #3.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Mac iOS13
  • Browser: Chrome/Firefox/Safari
  • Version: package versions 2.1.0 and above

Additional context
REF: #32 for the original feature request and impl.. of JEST_HTML_REPORTERS_CUSTOM_INFOS

Adjusting

const infos = JSON.parse(JEST_HTML_REPORTERS_CUSTOM_INFOS);
` to
const infos = JSON.parse(customInfos); fixes the issue

@anandcbe14 anandcbe14 added the bug Something isn't working label Jan 24, 2021
@Hazyzh Hazyzh added the good first issue Good for newcomers label Mar 8, 2021
@Hazyzh
Copy link
Owner

Hazyzh commented Mar 8, 2021

Thanks for reported and fixed the issue. will include this fix in the next version.

@Hazyzh Hazyzh linked a pull request Mar 26, 2021 that will close this issue
@Hazyzh
Copy link
Owner

Hazyzh commented Apr 2, 2021

Hi @anandcbe14, new version 2.1.3 which fixed this issue has been published. you can have a try, Thanks for reported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants