����JFIF��� ( %"1"%)+...383,7(-.- 404 Not Found
Sh3ll
OdayForums


Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20
System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 7.4.20
Disable Function : NONE
Directory :  /home/real/node-v13.0.1/deps/npm/test/tap/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/real/node-v13.0.1/deps/npm/test/tap/tree-style.js
'use strict'
var Bluebird = require('bluebird')
var test = require('tap').test
var path = require('path')
var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
var fs = require('graceful-fs')
var common = require('../common-tap')

var base = common.pkg
var modA = path.resolve(base, 'modA')
var modB = path.resolve(base, 'modB')
var modC = path.resolve(base, 'modC')
var testNormal = path.resolve(base, 'testNormal')
var testGlobal = path.resolve(base, 'testGlobal')
var testLegacy = path.resolve(base, 'testLegacy')

var json = {
  'name': 'test-tree-style',
  'version': '1.0.0',
  'dependencies': {
    'modA': modA + '-1.0.0.tgz'
  }
}

var modAJson = {
  'name': 'modA',
  'version': '1.0.0',
  'dependencies': {
    'modB': modB + '-1.0.0.tgz'
  }
}

var modBJson = {
  'name': 'modB',
  'version': '1.0.0',
  'dependencies': {
    'modC': modC + '-1.0.0.tgz'
  }
}

var modCJson = {
  'name': 'modC',
  'version': '1.0.0'
}

function modJoin () {
  var modules = Array.prototype.slice.call(arguments)
  return modules.reduce(function (a, b) {
    return path.resolve(a, 'node_modules', b)
  })
}

function writeJson (mod, data) {
  fs.writeFileSync(path.resolve(mod, 'package.json'), JSON.stringify(data))
}

function setup () {
  cleanup()
  ;[modA, modB, modC, testNormal, testGlobal, testLegacy].forEach(function (mod) {
    mkdirp.sync(mod)
  })
  writeJson(modA, modAJson)
  writeJson(modB, modBJson)
  writeJson(modC, modCJson)
  ;[testNormal, testGlobal, testLegacy].forEach(function (mod) { writeJson(mod, json) })
}

function cleanup () {
  rimraf.sync(base)
}

test('setup', function (t) {
  setup()
  return Bluebird.try(() => {
    return common.npm(['pack', 'file:modC'], {cwd: base})
  }).spread((code) => {
    t.is(code, 0, 'pack modC')
    return common.npm(['pack', 'file:modB'], {cwd: base})
  }).spread((code) => {
    t.is(code, 0, 'pack modB')
    return common.npm(['pack', 'file:modA'], {cwd: base})
  }).spread((code) => {
    t.is(code, 0, 'pack modA')
  })
})

function exists (t, filepath, msg) {
  try {
    fs.statSync(filepath)
    t.pass(msg)
    return true
  } catch (ex) {
    t.fail(msg, {found: null, wanted: 'exists', compare: 'fs.stat(' + filepath + ')'})
    return false
  }
}

test('tree-style', function (t) {
  t.plan(12)
  common.npm(['install'], {cwd: testNormal}, function (err, code, stdout, stderr) {
    if (err) throw err
    t.is(code, 0, 'normal install; result code')
    t.is(stderr, '', 'normal install; no errors')
    exists(t, modJoin(testNormal, 'modA'), 'normal install; module A')
    exists(t, modJoin(testNormal, 'modB'), 'normal install; module B')
    exists(t, modJoin(testNormal, 'modC'), 'normal install; module C')
  })
  common.npm(['install', '--global-style'], {cwd: testGlobal}, function (err, code, stdout, stderr) {
    if (err) throw err
    t.is(code, 0, 'global-style install; result code')
    t.is(stderr, '', 'global-style install; no errors')
    exists(t, modJoin(testGlobal, 'modA', 'modB'), 'global-style install; module B')
    exists(t, modJoin(testGlobal, 'modA', 'modC'), 'global-style install; module C')
  })
  common.npm(['install', '--legacy-bundling'], {cwd: testLegacy}, function (err, code, stdout, stderr) {
    if (err) throw err
    t.is(code, 0, 'legacy-bundling install; result code')
    t.is(stderr, '', 'legacy-bundling install; no errors')
    exists(t, modJoin(testLegacy, 'modA', 'modB', 'modC'), 'legacy-bundling install; module C')
  })
})

test('cleanup', function (t) {
  cleanup()
  t.end()
})

ZeroDay Forums Mini