• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

npm / init-package-json / 125 / 2
95%
master: 95%

Build:
Build:
LAST BUILD BRANCH: v2.0.3
DEFAULT BRANCH: master
Ran 04 Feb 2021 11:01PM UTC
Files 1
Run time 0s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

04 Feb 2021 10:08PM UTC coverage: 95.455% (+0.4%) from 95.062%
125.2

push

travis-ci

ruyadorno
fix: package.json saving optional deps

When saving over existing files that contains optionalDependencies it
should avoid also saving that dep to dependencies, respecting our docs
recommendation on it:

    Entries in optionalDependencies will override entries of the same
    name in dependencies, so it's usually best to only put in one place.

This patches this UX problem by adding an extra check that will avoid
adding a dependency to the package.json `dependencies` object in case
that package is already listed under `optionalDependencies`.

Relates to: https://github.com/npm/arborist/pull/221
Fixes: https://github.com/npm/cli/issues/724

PR-URL: https://github.com/npm/init-package-json/pull/109
Credit: @ruyadorno
Close: #109
Reviewed-by: @nlf, @wraithgar

53 of 65 branches covered (81.54%)

84 of 88 relevant lines covered (95.45%)

15.1 hits per line

Source Files on job 125.2
  • Tree
  • List 0
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 88
  • Travis Job 125.2
  • da71c050 on github
  • Prev Job for on latest (#121.1)
  • Next Job for on latest (#126.1)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc