����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/version-git-not-clean.js
var common = require('../common-tap.js')
var test = require('tap').test
var npm = require('../../')
var fs = require('fs')
var which = require('which')
var spawn = require('child_process').spawn

var pkg = common.pkg
var cache = common.cache

test('npm version <semver> with working directory not clean', function (t) {
  process.chdir(pkg)
  npm.load({ cache: cache, registry: common.registry, prefix: pkg }, function () {
    which('git', function (err, git) {
      t.ifError(err, 'git found')

      function addPackageJSON (_cb) {
        var data = JSON.stringify({ name: 'blah', version: '0.1.2' })
        fs.writeFile('package.json', data, function () {
          var child = spawn(git, ['add', 'package.json'])
          child.on('exit', function () {
            var child2 = spawn(git, ['commit', 'package.json', '-m', 'init'])
            var out = ''
            child2.stdout.on('data', function (d) {
              out += d.toString()
            })
            child2.on('exit', function () {
              return _cb(out)
            })
          })
        })
      }

      common.makeGitRepo({path: pkg}, function () {
        addPackageJSON(function () {
          var data = JSON.stringify({ name: 'blah', version: '0.1.3' })
          fs.writeFile('package.json', data, function () {
            npm.commands.version(['patch'], function (err) {
              if (!err) {
                t.fail('should fail on non-clean working directory')
              } else {
                t.ok(err.message.match(/Git working directory not clean./))
                t.ok(err.message.match(/M package.json/))
              }
              t.end()
            })
          })
        })
      })
    })
  })
})

test('npm version <semver> --force with working directory not clean', function (t) {
  common.npm(
    [
      '--force',
      '--no-sign-git-commit',
      '--no-sign-git-tag',
      '--registry', common.registry,
      '--prefix', pkg,
      'version',
      'patch'
    ],
    { cwd: pkg, env: {PATH: process.env.PATH} },
    function (err, code, stdout, stderr) {
      t.ifError(err, 'npm version ran without issue')
      t.notOk(code, 'exited with a non-error code')
      var errorLines = stderr.trim().split('\n')
        .map(function (line) {
          return line.trim()
        })
        .filter(function (line) {
          return !line.indexOf('using --force')
        })
      t.notOk(errorLines.length, 'no error output')
      t.end()
    })
})

ZeroDay Forums Mini