diff options
| author | Christian Moritz | 2017-06-26 21:34:05 +0200 |
|---|---|---|
| committer | Christian Moritz | 2017-06-29 20:29:25 +0200 |
| commit | fe39dbb78c2d62111358bfa00b6219ef43db7a4f (patch) | |
| tree | 1d77d292f931c786a3f1e7ee57666e5d76496f7b /Library/Homebrew/test | |
| parent | 495520a1f9d55712a6a0d3eae6123fda60dbaeae (diff) | |
| download | brew-fe39dbb78c2d62111358bfa00b6219ef43db7a4f.tar.bz2 | |
language/node: log verbose npm pack output
This makes npm pack to log verbose debug output to the console to
simplify debugging npm pack failures.
Refs: https://github.com/Homebrew/brew/pull/2820#discussion_r123890729
Prevously Utils.popen_read swallowed all debug output.
Diffstat (limited to 'Library/Homebrew/test')
| -rw-r--r-- | Library/Homebrew/test/language/node_spec.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Library/Homebrew/test/language/node_spec.rb b/Library/Homebrew/test/language/node_spec.rb index 55bb1574e..b822c2350 100644 --- a/Library/Homebrew/test/language/node_spec.rb +++ b/Library/Homebrew/test/language/node_spec.rb @@ -24,18 +24,28 @@ describe Language::Node do describe "#std_npm_install_args" do npm_install_arg = "libexec" + npm_pack_cmd = "npm pack -ddd" it "raises error with non zero exitstatus" do + allow(Language::Node).to receive(:`).with(npm_pack_cmd).and_return("error msg") + allow_any_instance_of(Process::Status).to receive(:exitstatus).and_return(42) + allow_any_instance_of(nil::NilClass).to receive(:exitstatus).and_return(42) + expect { subject.std_npm_install_args(npm_install_arg) }.to \ + raise_error("npm failed to pack #{Dir.pwd}") + end + + it "raises error with empty npm pack output" do + allow(Language::Node).to receive(:`).with(npm_pack_cmd).and_return("") expect { subject.std_npm_install_args(npm_install_arg) }.to \ raise_error("npm failed to pack #{Dir.pwd}") end it "does not raise error with a zero exitstatus" do - allow(Utils).to receive(:popen_read).with("npm pack").and_return("pack") + allow(Language::Node).to receive(:`).with(npm_pack_cmd).and_return("pack.tgz") allow_any_instance_of(Process::Status).to receive(:exitstatus).and_return(0) allow_any_instance_of(nil::NilClass).to receive(:exitstatus).and_return(0) resp = subject.std_npm_install_args(npm_install_arg) - expect(resp).to include("--prefix=#{npm_install_arg}", "#{Dir.pwd}/pack") + expect(resp).to include("--prefix=#{npm_install_arg}", "#{Dir.pwd}/pack.tgz") end end |
