Skip to content
This repository has been archived by the owner on Sep 23, 2018. It is now read-only.

Commit

Permalink
fix: should work when only current shrinkwrap.yaml is available
Browse files Browse the repository at this point in the history
  • Loading branch information
zkochan committed Feb 25, 2018
1 parent eeccd45 commit cb9051b
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/index.ts
Expand Up @@ -94,6 +94,7 @@ async function _outdated (
},
): Promise<OutdatedPackage[]> {
const wantedShrinkwrap = await readWantedShrinkwrap(pkgPath, {ignoreIncompatible: false})
|| await readCurrentShrinkwrap(pkgPath, {ignoreIncompatible: false})
if (!wantedShrinkwrap) {
throw new Error('No shrinkwrapfile in this directory. Run `pnpm install` to generate one.')
}
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/current-shrinkwrap-only/.gitignore
@@ -0,0 +1 @@
!node_modules

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions test/fixtures/current-shrinkwrap-only/package.json
@@ -0,0 +1,8 @@
{
"name": "wanted-shrinkwrap",
"version": "1.0.0",
"dependencies": {
"is-negative": "^2.1.0",
"is-positive": "^3.1.0"
}
}
13 changes: 13 additions & 0 deletions test/index.ts
Expand Up @@ -75,3 +75,16 @@ test('forPackages()', async (t) => {
])
t.end()
})

test('outdated() when only current shrinkwrap is present', async (t) => {
const outdatedPkgs = await outdated('current-shrinkwrap-only', outdatedOpts)
t.deepEqual(outdatedPkgs, [
{
current: '1.1.0',
latest: '2.1.0',
packageName: 'is-negative',
wanted: '1.1.0',
},
])
t.end()
})

0 comments on commit cb9051b

Please sign in to comment.