test/language/node: add test for prepare/prepack removal

This commit is contained in:
Dustin Rodrigues 2020-11-05 21:12:41 -05:00
parent c062429ddd
commit 027419effe

View File

@ -24,6 +24,20 @@ describe Language::Node do
end
end
describe "#std_pack_for_installation" do
npm_pack_cmd = "npm pack --ignore-scripts"
it "removes prepare and prepack scripts" do
path = Pathname("package.json")
path.atomic_write("{\"scripts\":{\"prepare\": \"ls\", \"prepack\": \"ls\", \"test\": \"ls\"}}")
allow(Utils).to receive(:popen_read).with(npm_pack_cmd).and_return(`echo pack.tgz`)
subject.pack_for_installation
expect(path.read).not_to include("prepare")
expect(path.read).not_to include("prepack")
expect(path.read).to include("test")
end
end
describe "#std_npm_install_args" do
npm_install_arg = Pathname("libexec")
npm_pack_cmd = "npm pack --ignore-scripts"