1 var test = require("tap").test
2 var npm = require.resolve("../../bin/npm-cli.js")
4 var spawn = require("child_process").spawn
5 var node = process.execPath
7 // ignore-scripts/package.json has scripts that always exit with non-zero error
8 // codes. The "install" script is omitted so that npm tries to run node-gyp,
9 // which should also fail.
10 var pkg = __dirname + "/ignore-scripts"
12 test("ignore-scripts: install using the option", function(t) {
13 createChild([npm, "install", "--ignore-scripts"]).on("close", function(code) {
19 test("ignore-scripts: install NOT using the option", function(t) {
20 createChild([npm, "install"]).on("close", function(code) {
27 "prepublish", "publish", "postpublish",
28 "preinstall", "install", "postinstall",
29 "preuninstall", "uninstall", "postuninstall",
30 "preupdate", "update", "postupdate",
31 "pretest", "test", "posttest",
32 "prestop", "stop", "poststop",
33 "prestart", "start", "poststart",
34 "prerestart", "restart", "postrestart"
37 scripts.forEach(function(script) {
38 test("ignore-scripts: run-script"+script+" using the option", function(t) {
39 createChild([npm, "--ignore-scripts", "run-script", script])
40 .on("close", function(code) {
47 scripts.forEach(function(script) {
48 test("ignore-scripts: run-script "+script+" NOT using the option", function(t) {
49 createChild([npm, "run-script", script]).on("close", function(code) {
56 function createChild (args) {
58 HOME: process.env.HOME,
59 Path: process.env.PATH,
60 PATH: process.env.PATH
63 if (process.platform === "win32")
64 env.npm_config_cache = "%APPDATA%\\npm-cache"
66 return spawn(node, args, {