diff options
author | Forrest L Norvell <forrest@npmjs.com> | 2015-04-04 03:51:40 +0300 |
---|---|---|
committer | Forrest L Norvell <forrest@npmjs.com> | 2015-04-04 03:51:40 +0300 |
commit | 891379fc7d32160d6543bf3e3f6f1ba328f855fd (patch) | |
tree | b5e7b9b5ae87a6e928a21c2a6b28deac23a9930a /test | |
parent | 54cd8956ea783f96749e46597d8c2cb9397c5d5f (diff) |
test: standardize / rearrange test file
Diffstat (limited to 'test')
-rw-r--r-- | test/tap/umask-lifecycle.js | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/test/tap/umask-lifecycle.js b/test/tap/umask-lifecycle.js index 38b3cf40e..aa07084f1 100644 --- a/test/tap/umask-lifecycle.js +++ b/test/tap/umask-lifecycle.js @@ -1,53 +1,55 @@ -var path = require("path") -var test = require("tap").test -var fs = require("fs") -var rimraf = require("rimraf") -var mkdirp = require("mkdirp") -var sprintf = require("sprintf-js").sprintf -var common = require("../common-tap.js") +var fs = require('fs') +var path = require('path') + +var mkdirp = require('mkdirp') +var rimraf = require('rimraf') +var test = require('tap').test +var sprintf = require('sprintf-js').sprintf + +var common = require('../common-tap.js') +var pkg = path.resolve(__dirname, 'umask-lifecycle') -var pkg = path.resolve(__dirname, "umask-lifecycle") var pj = JSON.stringify({ - name:"x", - version: "1.2.3", - scripts: { umask: "$npm_execpath config get umask && echo \"$npm_config_umask\" && node -pe 'process.umask()'" } -}, null, 2) + "\n" + name: 'x', + version: '1.2.3', + scripts: { umask: '$npm_execpath config get umask && echo "$npm_config_umask" && node -pe "process.umask()"' } +}, null, 2) + '\n' var umask = process.umask() var expected = [ - "", - "> x@1.2.3 umask "+path.join(__dirname, "umask-lifecycle"), - "> $npm_execpath config get umask && echo \"$npm_config_umask\" && node -pe 'process.umask()'", - "", - sprintf("%04o", umask), - sprintf("%04o", umask), - sprintf("%d", umask), - "" -].join("\n") + '', + '> x@1.2.3 umask ' + path.join(__dirname, 'umask-lifecycle'), + '> $npm_execpath config get umask && echo "$npm_config_umask" && node -pe "process.umask()"', + '', + sprintf('%04o', umask), + sprintf('%04o', umask), + sprintf('%d', umask), + '' +].join('\n') -test("setup", function (t) { +test('setup', function (t) { rimraf.sync(pkg) mkdirp.sync(pkg) - fs.writeFileSync(pkg + "/package.json", pj) + fs.writeFileSync(pkg + '/package.json', pj) t.end() }) -test("umask script", function (t) { - common.npm(["run", "umask"], { +test('umask script', function (t) { + common.npm(['run', 'umask'], { cwd: pkg, env: { PATH: process.env.PATH, Path: process.env.Path, - "npm_config_loglevel": "warn" + 'npm_config_loglevel': 'warn' } }, function (er, code, sout, serr) { t.equal(sout, expected) - t.equal(serr, "") + t.equal(serr, '') t.end() }) }) -test("clean", function (t) { +test('clean', function (t) { rimraf.sync(pkg) t.end() }) |