Skip to content

Commit

Permalink
[FIXED] Fix yarn not working with --project_path option
Browse files Browse the repository at this point in the history
[finish #154696328]

Signed-off-by: Li Tai <ltai@pivotal.io>
  • Loading branch information
xtreme-shane-lattanzio authored and Ryan Collins committed Jan 31, 2018
1 parent 785c07b commit c6ed08d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/license_finder/package_managers/yarn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def possible_package_paths
end

def current_packages
stdout, _stderr, status = Cmd.run(Yarn::SHELL_COMMAND)
stdout, _stderr, status = Cmd.run(Yarn::SHELL_COMMAND + " --cwd #{project_path}")
return [] unless status.success?

packages = []
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/license_finder/package_managers/yarn_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module LicenseFinder
subject { Yarn.new(project_path: Pathname('/app'), logger: double(:logger, active: nil)) }

it 'displays packages as returned from "yarn list"' do
allow(SharedHelpers::Cmd).to receive(:run).with(Yarn::SHELL_COMMAND) do
allow(SharedHelpers::Cmd).to receive(:run).with(Yarn::SHELL_COMMAND + " --cwd #{Pathname('/app')}") do
[yarn_shell_command_output, '', cmd_success]
end

Expand All @@ -31,7 +31,7 @@ module LicenseFinder
end

it 'displays incompatible packages with license type unknown' do
allow(SharedHelpers::Cmd).to receive(:run).with(Yarn::SHELL_COMMAND) do
allow(SharedHelpers::Cmd).to receive(:run).with(Yarn::SHELL_COMMAND + " --cwd #{Pathname('/app')}") do
['{"type":"info","data":"fsevents@1.1.1: The platform \"linux\" is incompatible with this module."}
{"type":"info","data":"\"fsevents@1.1.1\" is an optional dependency and failed compatibility check. Excluding it from installation."}', '', cmd_success]
end
Expand Down

0 comments on commit c6ed08d

Please sign in to comment.