mirror of
https://github.com/nodejs/node.git
synced 2025-05-15 14:12:28 +00:00

Contains the following npm releases: - https://github.com/npm/npm/releases/tag/v3.9.6 - https://github.com/npm/npm/releases/tag/v3.10.0 - https://github.com/npm/npm/releases/tag/v3.10.1 - https://github.com/npm/npm/releases/tag/v3.10.2 PR-URL: https://github.com/nodejs/node/pull/7410 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
65 lines
1.1 KiB
JavaScript
65 lines
1.1 KiB
JavaScript
'use strict'
|
|
var test = require('tap').test
|
|
var sortActions = require('../../lib/install/diff-trees.js').sortActions
|
|
var top = {
|
|
location: '/',
|
|
package: {},
|
|
requiredBy: [],
|
|
requires: [a, b],
|
|
isTop: true
|
|
}
|
|
var a = {
|
|
location: '/a',
|
|
package: {},
|
|
requiredBy: [],
|
|
requires: [c],
|
|
isTop: false,
|
|
userRequired: false,
|
|
existing: false,
|
|
parent: top
|
|
}
|
|
var b = {
|
|
location: '/b',
|
|
package: {},
|
|
requiredBy: [],
|
|
requires: [c],
|
|
isTop: false,
|
|
userRequired: false,
|
|
existing: false,
|
|
parent: top
|
|
}
|
|
var c = {
|
|
location: '/c',
|
|
package: {},
|
|
requiredBy: [a, b],
|
|
requires: [],
|
|
isTop: false,
|
|
userRequired: false,
|
|
existing: false,
|
|
parent: top
|
|
}
|
|
|
|
test('install-order when installing deps', function (t) {
|
|
var plain = [
|
|
['add', a],
|
|
['add', b],
|
|
['add', c]]
|
|
var sorted = [
|
|
['add', c],
|
|
['add', a],
|
|
['add', b]]
|
|
t.isDeeply(sortActions(plain), sorted)
|
|
t.end()
|
|
})
|
|
|
|
test('install-order when not installing deps', function (t) {
|
|
var plain = [
|
|
['add', a],
|
|
['add', b]]
|
|
var sorted = [
|
|
['add', a],
|
|
['add', b]]
|
|
t.isDeeply(sortActions(plain), sorted)
|
|
t.end()
|
|
})
|