Skip to content

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

Closed

Description

@gaearon

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.

Activity

  1. added this to the milestone on Mar 5, 2017
  2. lpalmes commented on Mar 6, 2017

    @lpalmes
    Contributor

    @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

  3. Timer commented on Mar 8, 2017

    @Timer
    Contributor

    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!

  4. Timer commented on Mar 14, 2017

    @Timer
    Contributor

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

  5. lpalmes commented on Mar 14, 2017

    @lpalmes
    Contributor

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

  6. Timer commented on Mar 14, 2017

    @Timer
    Contributor

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

  7. lpalmes commented on Mar 14, 2017

    @lpalmes
    Contributor

    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.

  8. locked and limited conversation to collaborators on Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions