mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-25 02:21:52 -04:00
* perf: validating the node_modules structure to a specified depth Ref #722 * feat: adding an update boolean property to the install API BREAKING CHANGE: Dependencies won't be updated when `update` is `false`. It doesn't matter what the value of `depth` is. `depth` is used for specifying how deep should the install algorithm analize the dependency tree. Ref #722 * refactor: merge new resolved deps with the previous
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import {installPkgs, install} from '../src'
|
|
import {prepare, addDistTag, testDefaults} from './utils'
|
|
import tape = require('tape')
|
|
import promisifyTape from 'tape-promise'
|
|
import exists = require('path-exists')
|
|
import path = require('path')
|
|
|
|
const test = promisifyTape(tape)
|
|
|
|
test('should fail to update when requests are cached', async function (t) {
|
|
const project = prepare(t)
|
|
|
|
const metaCache = new Map()
|
|
|
|
await addDistTag('dep-of-pkg-with-1-dep', '100.0.0', 'latest')
|
|
|
|
await installPkgs(['pkg-with-1-dep'], testDefaults({save: true, metaCache}))
|
|
|
|
await project.storeHas('dep-of-pkg-with-1-dep', '100.0.0')
|
|
|
|
await addDistTag('dep-of-pkg-with-1-dep', '100.1.0', 'latest')
|
|
|
|
await install(testDefaults({depth: 1, metaCache, update: true}))
|
|
|
|
await project.storeHas('dep-of-pkg-with-1-dep', '100.0.0')
|
|
})
|
|
|
|
test('should not cache when cache is not used', async function (t) {
|
|
const project = prepare(t)
|
|
|
|
await addDistTag('dep-of-pkg-with-1-dep', '100.0.0', 'latest')
|
|
|
|
await installPkgs(['pkg-with-1-dep'], testDefaults({save: true}))
|
|
|
|
await project.storeHas('dep-of-pkg-with-1-dep', '100.0.0')
|
|
|
|
await addDistTag('dep-of-pkg-with-1-dep', '100.1.0', 'latest')
|
|
|
|
await install(testDefaults({depth: 1, update: true}))
|
|
|
|
await project.storeHas('dep-of-pkg-with-1-dep', '100.1.0')
|
|
})
|