2 var path = require('path')
4 var mkdirp = require('mkdirp')
5 var rimraf = require('rimraf')
6 var test = require('tap').test
7 var sprintf = require('sprintf-js').sprintf
9 var common = require('../common-tap.js')
10 var pkg = path.resolve(__dirname, 'umask-lifecycle')
12 var pj = JSON.stringify({
15 scripts: { umask: '$npm_execpath config get umask && echo "$npm_config_umask" && node -pe "process.umask()"' }
18 var umask = process.umask()
21 '> x@1.2.3 umask ' + path.join(__dirname, 'umask-lifecycle'),
22 '> $npm_execpath config get umask && echo "$npm_config_umask" && node -pe "process.umask()"',
24 sprintf('%04o', umask),
25 sprintf('%04o', umask),
30 test('setup', function (t) {
33 fs.writeFileSync(pkg + '/package.json', pj)
37 test('umask script', function (t) {
38 common.npm(['run', 'umask'], {
41 PATH: process.env.PATH,
42 Path: process.env.Path,
43 'npm_config_loglevel': 'warn'
45 }, function (er, code, sout, serr) {
46 t.equal(sout, expected)
52 test('clean', function (t) {