]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/test/tap/umask-lifecycle.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / test / tap / umask-lifecycle.js
1 var fs = require('fs')
2 var path = require('path')
3
4 var mkdirp = require('mkdirp')
5 var rimraf = require('rimraf')
6 var test = require('tap').test
7 var sprintf = require('sprintf-js').sprintf
8
9 var common = require('../common-tap.js')
10 var pkg = path.resolve(__dirname, 'umask-lifecycle')
11
12 var pj = JSON.stringify({
13   name: 'x',
14   version: '1.2.3',
15   scripts: { umask: '$npm_execpath config get umask && echo "$npm_config_umask" && node -pe "process.umask()"' }
16 }, null, 2) + '\n'
17
18 var umask = process.umask()
19 var expected = [
20   '',
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()"',
23   '',
24   sprintf('%04o', umask),
25   sprintf('%04o', umask),
26   sprintf('%d', umask),
27   ''
28 ].join('\n')
29
30 test('setup', function (t) {
31   rimraf.sync(pkg)
32   mkdirp.sync(pkg)
33   fs.writeFileSync(pkg + '/package.json', pj)
34   t.end()
35 })
36
37 test('umask script', function (t) {
38   common.npm(['run', 'umask'], {
39     cwd: pkg,
40     env: {
41       PATH: process.env.PATH,
42       Path: process.env.Path,
43       'npm_config_loglevel': 'warn'
44     }
45   }, function (er, code, sout, serr) {
46     t.equal(sout, expected)
47     t.equal(serr, '')
48     t.end()
49   })
50 })
51
52 test('clean', function (t) {
53   rimraf.sync(pkg)
54   t.end()
55 })