Skip to content

Conversation

@natecavanaugh
Copy link
Contributor

When findUp can't find an existing package-scripts.js file, it returns null, which is passed back to
findUp and throws an error because path.resolve can only accept strings as arguments

#124

What: Fixes error thrown when a package-scripts.js file doesn't exist while running init

Why: Because if you're running nps init without an existing package-scripts.js file, it won't work, forcing developers to have to create the file manually.

How: Checking that the path returned from getPSConfigFilepath is actually a string before passing it to findUp.sync.

I tried figuring out why the tests never fail for this, but I believe it's because of jest's mocking of findUp means that it never even hits the path.resolve method, so I'm not sure how you'd want to test for this particular case.

When findUp can't find an existing package-scripts.js file, it returns null, which is passed back to
findUp and throws an error because path.resolve can only accept strings as arguments

sezna#124
@codecov-io
Copy link

codecov-io commented Mar 21, 2017

Codecov Report

Merging #127 into master will not change coverage.
The diff coverage is 100%.

@@          Coverage Diff          @@
##           master   #127   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          10     10           
  Lines         286    286           
=====================================
  Hits          286    286
Impacted Files Coverage Δ
src/bin-utils/parser.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 45aead4...76b6f57. Read the comment docs.

Copy link
Collaborator

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

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

Just a small fix to the contributors table :)

"name": "Nate Cavanaugh",
"avatar_url": "https://avatars1.githubusercontent.com/u/116871?v=3",
"profile": "http://alterform.com",
"contributions": []
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you add "code" to this array and then run npm start generateContributors?

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, thanks for the heads up :)

@kentcdodds
Copy link
Collaborator

This is great, thank you!

The contributions array in .all-contributorsrc was missing the "code" value
@kentcdodds
Copy link
Collaborator

Thank you so much!

@kentcdodds kentcdodds merged commit d81c793 into sezna:master Mar 21, 2017
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