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

Unable to attach JSON response in the report #328

Open
varshanharshank opened this issue Mar 25, 2024 · 2 comments
Open

Unable to attach JSON response in the report #328

varshanharshank opened this issue Mar 25, 2024 · 2 comments
Labels
Milestone

Comments

@varshanharshank
Copy link

Environment (please complete the following information):

  • multiple-cucumber-html-reporter: [e.g. 1.10.0] - 3.6.0
  • Node.js version: [e.g. 8.9.1]- v18.17.1
  • NPM version: [e.g. 5.8.0] - v18.17.1
  • Platform name and version: [e.g. Windows 10] - mac sonoma 14.4
  • Cucumber version: [e.g. 4.2.0] - 9.3.0

Config of multiple-cucumber-html-reporter
An example of how you configured the reporter in your config

import report = require('multiple-cucumber-html-reporter')
report.generate({
jsonDir: 'reports/cucumberReport',
reportName: 'Portal Report',
reportPath: './reports/cucumberReport',
metadata: {
browser: {
name: '',
version: '',
},
device: 'Local test machine',
platform: {
name: '',
version: '',
},
},
customData: {
title: 'Run info',
data: [
{ label: 'Project', value: 'Test' },
{ label: 'Application', value: 'Portal' },
],
},
})

Describe the bug
Try to attach the json log in the step definition and it is not attaching in the multiple-cucumber-html-reporter. But it is working fine in the normal cucumber report

/Users/test/Documents/Workspace/miscellaneous/PurpleRouter/node_modules/multiple-cucumber-html-reporter/lib/generate-report.js:406
scenario.steps.forEach((step) => {
^
SyntaxError: Unexpected token i in JSON at position 0
at JSON.parse ()
at /Users/test/Documents/Workspace/miscellaneous/PurpleRouter/node_modules/multiple-cucumber-html-reporter/lib/generate-report.js:425:24
at Array.forEach ()
at /Users/test/Documents/Workspace/miscellaneous/PurpleRouter/node_modules/multiple-cucumber-html-reporter/lib/generate-report.js:409:25
at Array.forEach ()
at _parseSteps (/Users/test/Documents/Workspace/miscellaneous/PurpleRouter/node_modules/multiple-cucumber-html-reporter/lib/generate-report.js:406:20)
at /Users/test/Documents/Workspace/miscellaneous/PurpleRouter/node_modules/multiple-cucumber-html-reporter/lib/generate-report.js:328:18
at Array.forEach ()
at _parseScenarios (/Users/test/Documents/Workspace/miscellaneous/PurpleRouter/node_modules/multiple-cucumber-html-reporter/lib/generate-report.js:318:22)
at /Users/test/Documents/Workspace/miscellaneous/PurpleRouter/node_modules/multiple-cucumber-html-reporter/lib/generate-report.js:226:17

But i could see json response in the normal cucumber report

image

To Reproduce
Steps to reproduce the behavior:

  1. Try to attach any of json response in the cucmeber step definion
image 2. Run the following command to generate report and observe

npx ts-node src/helper/report/cucumberReport.ts
3. observe the error

[Include code or an example repository that can easily be set up]

Expected behavior
It should not throw error and able to generate reprot

Log
If applicable, add logs to help explain your problem. If you don't have logs, enable 'debug:true' in the config and paste the log here.
Please use proper markdown to style it

Additional context
Add any other context about the problem here.

@varshanharshank
Copy link
Author

varshanharshank commented Mar 25, 2024

@WasiqB please look into this issue

@varshanharshank
Copy link
Author

@WasiqB do you have any update about this issue

@WasiqB WasiqB added this to the v3.7.0 milestone Apr 28, 2024
@WasiqB WasiqB added the bug label Apr 28, 2024
@WasiqB WasiqB modified the milestones: v3.8.0, v4.0.0 Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants