-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(view): Show the correct publish date for versions selected by range
Before, `npm view npm@^6` would incorrectly report “published over a year from now” for every entry. Now it reports the correct dates. PR-URL: #3739 Credit: @andersk Close: #3739 Reviewed-by: @wraithgar
- Loading branch information
Showing
3 changed files
with
32 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,9 @@ const cleanLogs = () => { | |
console.log = fn | ||
} | ||
|
||
// 25 hours ago | ||
const yesterday = new Date(Date.now() - 1000 * 60 * 60 * 25) | ||
|
||
const packument = (nv, opts) => { | ||
if (!opts.fullMetadata) | ||
throw new Error('must fetch fullMetadata') | ||
|
@@ -40,7 +43,7 @@ const packument = (nv, opts) => { | |
latest: '1.0.0', | ||
}, | ||
time: { | ||
'1.0.0': '2019-08-06T16:21:09.842Z', | ||
'1.0.0': yesterday, | ||
}, | ||
versions: { | ||
'1.0.0': { | ||
|
@@ -332,6 +335,13 @@ t.test('should log package info', t => { | |
}) | ||
}) | ||
|
||
t.test('package with semver range', t => { | ||
view.exec(['blue@^1.0.0'], () => { | ||
t.matchSnapshot(logs) | ||
t.end() | ||
}) | ||
}) | ||
|
||
t.test('package with no modified time', t => { | ||
viewUnicode.exec(['[email protected]'], () => { | ||
t.matchSnapshot(logs) | ||
|