• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict'
2var test = require('tap').test
3var requireInject = require('require-inject')
4var log = require('npmlog')
5
6/*
7The remove actions need to happen in the opposite of their normally defined
8order. That is, they need to go shallow -> deep.
9*/
10
11var unbuilt = []
12var npm = requireInject.installGlobally('../../lib/npm.js', {
13  '../../lib/install/action/unbuild.js': function (staging, pkg, log, next) {
14    unbuilt.push(pkg.package.name)
15    next()
16  }
17})
18
19test('setup', function (t) {
20  npm.load(function () {
21    t.pass('npm loaded')
22    t.end()
23  })
24})
25
26test('abc', function (t) {
27  var Installer = require('../../lib/install.js').Installer
28  var inst = new Installer(__dirname, false, [])
29  inst.progress = {executeActions: log}
30  inst.todo = [
31    ['unbuild', {package: {name: 'first'}}],
32    ['unbuild', {package: {name: 'second'}}]
33  ]
34  inst.executeActions(function () {
35    t.isDeeply(unbuilt, ['second', 'first'])
36    t.end()
37  })
38})
39