���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() 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/ |
/* eslint-disable no-template-curly-in-string */ const fs = require('fs') const mkdirp = require('mkdirp') const rimraf = require('rimraf') const path = require('path') const ini = require('ini') const test = require('tap').test const npmconf = require('../../lib/config/core.js') const common = require('../common-tap.js') const packagePath = common.pkg const packageJsonFile = JSON.stringify({ name: 'config-envReplace' }) const inputConfigFile = [ 'registry=${NPM_REGISTRY_URL}', '//${NPM_REGISTRY_HOST}/:_authToken=${NPM_AUTH_TOKEN}', 'always-auth=true', '' ].join('\n') const expectConfigFile = [ 'registry=http://my.registry.com/', '//my.registry.com/:_authToken=xxxxxxxxxxxxxxx', 'always-auth=true', '' ].join('\n') test('environment variables replacing in configs', function (t) { process.env = Object.assign(process.env, { NPM_REGISTRY_URL: 'http://my.registry.com/', NPM_REGISTRY_HOST: 'my.registry.com', NPM_AUTH_TOKEN: 'xxxxxxxxxxxxxxx' }) mkdirp.sync(packagePath) const packageJsonPath = path.resolve(packagePath, 'package.json') const configPath = path.resolve(packagePath, '.npmrc') fs.writeFileSync(packageJsonPath, packageJsonFile) fs.writeFileSync(configPath, inputConfigFile) const originalCwdPath = process.cwd() process.chdir(packagePath) npmconf.load(function (error, conf) { if (error) throw error const foundConfigFile = ini.stringify(conf.sources.project.data) t.same(ini.parse(foundConfigFile), ini.parse(expectConfigFile)) fs.unlinkSync(packageJsonPath) fs.unlinkSync(configPath) rimraf.sync(packagePath) process.chdir(originalCwdPath) t.end() }) })