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

fix(reporters): Add a default value to the JSONReporter constructor #33

Merged
merged 1 commit into from Nov 14, 2018

Conversation

antoinerey
Copy link
Contributor

At the moment, calling new JSONReporter() throws the following error : Cannot destructure property stream of 'undefined' or 'null'

This is because of this line : constructor ({ stream }), where you destructure the argument. If no argument is given, the code crashes.

This PR applies a default value (en empty object) to the argument, so we don't have to pass an empty object to instanciate the JSONReporter.

After this update, all the following works as expected.

  • new JSONReporter()
  • new JSONReporter({})
  • new JSONReporter({ stream: <variable> })

At the moment, calling `new JSONReporter()` throws the following error : `Cannot destructure property stream of 'undefined' or 'null'`

This is because of this line : `constructor ({ stream })`, where you destructure the argument. If no argument is given, the code crashes. 

This PR applies a default value (en empty object) to the argument, so we don't have to pass an empty object to instanciate the `JSONReporter`.

After this update, all the following works as expected. 

- `new JSONReporter()`
- `new JSONReporter({})`
- `new JSONReporter({ stream: <variable> })`
@pi0 pi0 merged commit c59db36 into unjs:master Nov 14, 2018
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

Successfully merging this pull request may close these issues.

None yet

2 participants