Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
fix: install exact versions (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhadaily authored and believer committed Oct 2, 2019
1 parent 58fb979 commit b510a36
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/utils/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ export const installPkg = async (

if (!hasPackageInstalled) {
console.log(`Installing ${chalk.blue(packageName)}`)
await execa.command(`npm install --save-dev ${packageName}`, options)
await execa.command(
`npm install --save-dev --save-exact ${packageName}`,
options
)
}
}
13 changes: 8 additions & 5 deletions test/utils/file.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ describe('#installPkg', () => {

expect(global.console.log).toHaveBeenCalledWith('Installing jest')
expect(execa.command).toHaveBeenCalledWith(
'npm install --save-dev jest',
'npm install --save-dev --save-exact jest',
{}
)
})
Expand All @@ -278,7 +278,7 @@ describe('#installPkg', () => {

expect(global.console.log).not.toHaveBeenCalledWith('Installing jest')
expect(execa.command).not.toHaveBeenCalledWith(
'npm install --save-dev jest',
'npm install --save-dev --save-exact jest',
{}
)
})
Expand All @@ -289,8 +289,11 @@ describe('#installPkg', () => {
await installPkg('jest', { cwd: 'test' })

expect(global.console.log).toHaveBeenCalledWith('Installing jest')
expect(execa.command).toHaveBeenCalledWith('npm install --save-dev jest', {
cwd: expect.stringMatching(/test/),
})
expect(execa.command).toHaveBeenCalledWith(
'npm install --save-dev --save-exact jest',
{
cwd: expect.stringMatching(/test/),
}
)
})
})

0 comments on commit b510a36

Please sign in to comment.