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

HTML fails to generate if event values are objects #105

Open
gpaciga opened this issue Aug 29, 2023 · 0 comments
Open

HTML fails to generate if event values are objects #105

gpaciga opened this issue Aug 29, 2023 · 0 comments

Comments

@gpaciga
Copy link

gpaciga commented Aug 29, 2023

We have run into cases of trying to log a JavaScript object, without stringifying it. The master json file seems to be generated fine, but the html file is not generated. For example, when logging:

"foobar string"

and

{foobar: object}

the events part of the JSON for the test looks like:

  "events": [
    {
      "type": "log",
      "value": "foobar string"
    },
    {
      "type": "log",
      "value": {
        "foobar": "object"
      }
    }
  ],

so my presumption is that this causes something to go wrong when writing the HTML, but not the JSON.

We are using process.emit("test:log", message) to add to the log, as one step in a custom logging method that does some other things at the same time (console log, allure steps, etc). If there is a more proper way to log things like this that would bypass this issue, I'd be happy to change our implementation. I would just JSON.stringify() everything but I don't want to lose nuance for things that aren't JSON (like NaN, Infinity, etc).

At a minimum, something to surface the error to the user would be nice rather than failing silently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant