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(server): use flatted for json.stringify #3220

Merged
merged 1 commit into from
Nov 28, 2018

Conversation

johnjbarton
Copy link
Contributor

Remove json3 dep and use, probably was needed for older node code.
Fixes #3215

@johnjbarton johnjbarton requested a review from lusarz November 26, 2018 17:30
lib/server.js Outdated
@@ -8,6 +8,8 @@ const spawn = require('child_process').spawn
const tmp = require('tmp')
const fs = require('fs')
const path = require('path')
const {stringify} = require('flatted/cjs')
Copy link
Contributor

@lusarz lusarz Nov 26, 2018

Choose a reason for hiding this comment

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

Would you mind to wrap this dependency into JSONUtils and add unit tests for it, something like we have with sha1 calculation ?

I like this kind of wrapping because of two reasons:

  • dependencies sometimes change theirs APIs and behaviour - with wrapper covered by unit tests we're able to figure it out very early
  • it's easier to remove dependency in future when it's used in single place

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


const JsonUtils = require('../../../lib/utils/json-utils')

describe('Utils', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to add one test that covers circular structure issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Remove json3 dep and use, probably was needed for older node code.
Fixes karma-runner#3215
@johnjbarton johnjbarton merged commit fb05fb1 into karma-runner:master Nov 28, 2018
@swimmadude66
Copy link

@johnjbarton I see this made it to master, any idea of when a release will be cut with this feature? The circular json error this fixes is blocking angular 7 workflows from using karma

@lusarz
Copy link
Contributor

lusarz commented Dec 1, 2018

As a temporary solution it's possible to set dependency as github branch link. This article may be useful in this context :

https://medium.com/@jonchurch/use-github-branch-as-dependency-in-package-json-5eb609c81f1a

@swimmadude66
Copy link

swimmadude66 commented Dec 2, 2018

@lusarz thanks for the link, that is definitely helpful to unblock some of my side projects. I'm hesitant to use that method for a prod system however, so I think I will just pin those systems to v6 until this is officially cut in a release.

EDIT: Just saw v3.1.3, thanks you guys!

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.

3 participants