1 // verify that prepublish runs on pack and publish
2 var test = require("tap").test
3 var common = require("../common-tap")
4 var fs = require("graceful-fs")
5 var join = require("path").join
6 var mkdirp = require("mkdirp")
7 var rimraf = require("rimraf")
9 var pkg = join(__dirname, "scoped_package")
10 var manifest = join(pkg, "package.json")
11 var tmp = join(pkg, "tmp")
12 var cache = join(pkg, "cache")
15 name : "@scope/generic-package",
16 version : "90000.100001.5"
19 test("setup", function (t) {
30 return function (er) {
37 fs.writeFile(manifest, JSON.stringify(data), "ascii", done)
48 test("test", function (t) {
50 "npm_config_cache" : cache,
51 "npm_config_tmp" : tmp,
52 "npm_config_prefix" : pkg,
53 "npm_config_global" : "false"
56 for (var i in process.env) {
57 if (!/^npm_config_/.test(i)) env[i] = process.env[i]
66 }, function(err, code, stdout, stderr) {
67 t.ifErr(err, "npm pack finished without error")
68 t.equal(code, 0, "npm pack exited ok")
69 t.notOk(stderr, "got stderr data: " + JSON.stringify("" + stderr))
70 stdout = stdout.trim()
71 var regex = new RegExp("scope-generic-package-90000.100001.5.tgz", "ig")
72 t.ok(stdout.match(regex), "found package")
77 test("cleanup", function (t) {