����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-windows-newlines.js
var fs = require('graceful-fs')
var path = require('path')
var existsSync = fs.existsSync || path.existsSync

var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
var test = require('tap').test

var common = require('../common-tap.js')

var pkg = common.pkg

var EXEC_OPTS = { cwd: pkg, stdio: [0, 1, 2] }

var json = {
  name: 'install-windows-newlines',
  description: 'fixture',
  version: '0.0.0',
  dependencies: {
    'cli-dependency': 'file:cli-dependency'
  }
}

var dependency = {
  name: 'cli-dependency',
  description: 'fixture',
  version: '0.0.0',
  bin: {
    hashbang: './hashbang.js',
    nohashbang: './nohashbang.js'
  }
}

test('setup', function (t) {
  cleanup()
  mkdirp.sync(path.join(pkg, 'cli-dependency'))
  fs.writeFileSync(
    path.join(pkg, 'cli-dependency', 'package.json'),
    JSON.stringify(dependency, null, 2)
  )
  fs.writeFileSync(
    path.join(pkg, 'cli-dependency', 'hashbang.js'),
    '#!/usr/bin/env node\r\nconsole.log(\'Hello, world!\')\r\n'
  )
  fs.writeFileSync(
    path.join(pkg, 'cli-dependency', 'nohashbang.js'),
    '\'use strict\'\r\nconsole.log(\'Goodbye, world!\')\r\n'
  )

  mkdirp.sync(path.join(pkg, 'node_modules'))
  fs.writeFileSync(
    path.join(pkg, 'package.json'),
    JSON.stringify(json, null, 2)
  )

  return common.npm(['install'], EXEC_OPTS).spread((code) => {
    t.equal(code, 0, 'npm install did not raise error code')
    t.ok(
      existsSync(path.resolve(pkg, 'node_modules/.bin/hashbang')),
      'hashbang installed'
    )
    t.ok(
      existsSync(path.resolve(pkg, 'node_modules/.bin/nohashbang')),
      'nohashbang installed'
    )
    t.notOk(
      fs.readFileSync(
        path.resolve(pkg, 'node_modules/cli-dependency/hashbang.js'),
        'utf8'
      ).includes('node\r\n'),
      'hashbang dependency cli newlines converted'
    )
    t.ok(
      fs.readFileSync(
        path.resolve(pkg, 'node_modules/cli-dependency/nohashbang.js'),
        'utf8'
      ).includes('\r\n'),
      'nohashbang dependency cli newlines retained'
    )
  })
})

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

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

ZeroDay Forums Mini