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

Check for accidental extraneous dependencies in end-to-end-tests #1720

Closed
gaearon opened this issue Mar 5, 2017 · 6 comments
Closed

Check for accidental extraneous dependencies in end-to-end-tests #1720

gaearon opened this issue Mar 5, 2017 · 6 comments

Comments

@gaearon
Copy link
Contributor

gaearon commented Mar 5, 2017

See the discussion in #1685 (comment).
@lpalmes might want to work on this so please don’t jump on the issue yet unless you’re @lpalmes.

@lpalmes
Copy link
Contributor

lpalmes commented Mar 6, 2017

@gaearon @Timer,
I've been testing some awk commands a bit

$ awk '/dependencies/{y=1;next}/},/{y=0; next}y' package.json
    "react": "^15.4.2",
    "react-dom": "^15.4.2"
$ awk '/devDependencies/{y=1;next}/},/{y=0; next}y' package.json
    "react-scripts": "0.9.4"

This will get between the word dependencies and the closing bracket below the dependencies, i only need to check if every dependency is correct.
If you have any ideas how to do this let me know, i was thinking it could be possible to partly match each line to react

@Timer
Copy link
Contributor

Timer commented Mar 8, 2017

I've been a bit busy, @lpalmes -- sorry for not giving you a quicker response.
We can probably grep inverted what comes back from that, validating they're packages we want:

awk '/dependencies/{y=1;next}/},/{y=0; next}y' package.json | \
  grep -v -q -E '^\s*"react(?:-dom|-scripts)?"'

-v is invert match & -q is quiet -- we only care about the return code .

Then just test to make sure the result of that is not 0, because 0 would mean it found something extraneous!

@Timer
Copy link
Contributor

Timer commented Mar 14, 2017

@lpalmes Hi! How's everything going?
Would you like to finish this? 😄 If you're too short on time, that's alright too.

@lpalmes
Copy link
Contributor

lpalmes commented Mar 14, 2017

I was traveling, got back yesterday, sorry for the absence.
I will add it today, i let you know otherwise today @Timer

@Timer
Copy link
Contributor

Timer commented Mar 14, 2017

Sweet, thanks @lpalmes!
Hope you enjoyed your travels & were safe! 😄

@lpalmes
Copy link
Contributor

lpalmes commented Mar 14, 2017

Thanks @Timer, i've enjoyed it and managed to meet lot of developers and companies, just what i was looking for 😄 , really great experience.
I've just sent the pull request to fix this. I've tried on my computer, and it worked quite nicely. I've added some random deps to package.json and confirmed that errors correctly.

@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants