hunk.code_window:         version: '1.0.0',
         },
       ],
       reason: 'incompatible_engine',
     })
     const reportedTimes = reporter.withArgs(logMatcher).callCount
     t.equal(reportedTimes, 1, 'skipping optional dependency is logged')
   })
  
hunk.labels: keep keep keep replace keep keep keep keep keep
hunk.after_edit:     reason: 'unsupported_platform',
  
hunk.file_path: test/install/optionalDependencies.ts
hunk.type: replace
file: import {install, installPkgs} from 'supi'
  import tape = require('tape')
  import promisifyTape from 'tape-promise'
  import {
    addDistTag,
    prepare,
    testDefaults,
  } from '../utils'
  
  const test = promisifyTape(tape)
  
  test('preserve subdeps on update', async (t: tape.Test) => {
    const project = prepare(t)
  
    await Promise.all([
      addDistTag('foobarqar', '1.0.0', 'latest'),
      addDistTag('foo', '100.0.0', 'latest'),
      addDistTag('bar', '100.0.0', 'latest'),
      addDistTag('abc-grand-parent-with-c', '1.0.0', 'latest'),
      addDistTag('abc-parent-with-ab', '1.0.0', 'latest'),
    ])
  
    await installPkgs(['foobarqar', 'abc-grand-parent-with-c'], await testDefaults())
  
    await Promise.all([
      addDistTag('foobarqar', '1.0.1', 'latest'),
      addDistTag('foo', '100.1.0', 'latest'),
      addDistTag('bar', '100.1.0', 'latest'),
      addDistTag('abc-grand-parent-with-c', '1.0.1', 'latest'),
      addDistTag('abc-parent-with-ab', '1.0.1', 'latest'),
    ])
  
    await install(await testDefaults({update: true, depth: 0}))
  
    const shr = await project.loadShrinkwrap()
  
    t.ok(shr.packages)
    t.ok(shr.packages['/abc-parent-with-ab/1.0.0/peer-c@1.0.0'], 'preserve version of package that has resolved peer deps')
    t.ok(shr.packages['/foobarqar/1.0.1'])
    t.deepEqual(shr.packages['/foobarqar/1.0.1'].dependencies, {
      bar: '100.0.0',
      foo: '100.0.0',
      qar: '100.0.0',
    })
  })
  
  test('update does not fail when package has only peer dependencies', async (t: tape.Test) => {
    prepare(t)
  
    await installPkgs(['has-pkg-with-peer-only'], await testDefaults())
  
    await install(await testDefaults({update: true, depth: Infinity}))
  
    t.pass('did not fail')
  })
  