Skip to content

Commit

Permalink
fix(ping): make "npm ping" echo a right time
Browse files Browse the repository at this point in the history
There is no need to make the time divided by 1000 because of the time unit 'ms'.
Currently a typical command and response:
PS C:\projects> npm ping
npm notice PING http://registry.npmjs.org/
npm notice PONG 0.752ms

PR-URL: #3474
Credit: @aluneed
Close: #3474
Reviewed-by: @wraithgar
  • Loading branch information
aluneed authored and wraithgar committed Jun 28, 2021
1 parent 013f026 commit 0dd0341
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ping.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Ping extends BaseCommand {
const start = Date.now()
const details = await pingUtil(this.npm.flatOptions)
const time = Date.now() - start
log.notice('PONG', `${time / 1000}ms`)
log.notice('PONG', `${time}ms`)
if (this.npm.config.get('json')) {
this.npm.output(JSON.stringify({
registry: this.npm.config.get('registry'),
Expand Down

1 comment on commit 0dd0341

@a2281888999
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.