Skip to content

Commit

Permalink
Merge pull request #970 from snyk/feat/increase-default-depth-all-pro…
Browse files Browse the repository at this point in the history
…jects

feat: increase default levels deep to 2 for `--all-projects`
  • Loading branch information
lili2311 authored Jan 27, 2020
2 parents a724b21 + 7c60f77 commit d9af224
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion help/help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ Experimental options:
--detection-depth=<number>
(test & monitor commands only)
Use with --all-projects to indicate how many sub-directories to search.
Defaults to 1 (the current working directory).
Defaults to 2 (the current working directory and one sub-directory).
--exclude=<comma seperated list of directory names>
(test & monitor commands only)
Can only be used with --all-projects to indicate sub-directories to exclude.
Expand Down
2 changes: 1 addition & 1 deletion src/lib/plugins/get-deps-from-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export async function getDepsFromPlugin(
let inspectRes: pluginApi.InspectResult;

if (options.allProjects) {
const levelsDeep = options.detectionDepth || 1; // default to 1 level deep
const levelsDeep = options.detectionDepth;
const ignore = options.exclude ? options.exclude.split(',') : [];
const targetFiles = await find(
root,
Expand Down
2 changes: 2 additions & 0 deletions test/acceptance/cli-monitor/cli-monitor.all-projects.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const AllProjectsTests: AcceptanceTests = {

const result = await params.cli.monitor('mono-repo-project', {
allProjects: true,
detectionDepth: 1,
});
t.ok(spyPlugin.withArgs('rubygems').calledOnce, 'calls rubygems plugin');
t.ok(spyPlugin.withArgs('npm').calledOnce, 'calls npm plugin');
Expand Down Expand Up @@ -143,6 +144,7 @@ export const AllProjectsTests: AcceptanceTests = {

await params.cli.monitor('mono-repo-project', {
allProjects: true,
detectionDepth: 1,
});
// Pop all calls to server and filter out calls to `featureFlag` endpoint
const [rubyAll, npmAll, mavenAll] = params.server
Expand Down
2 changes: 2 additions & 0 deletions test/acceptance/cli-test/cli-test.all-projects.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const AllProjectsTests: AcceptanceTests = {

const result = await params.cli.test('mono-repo-project', {
allProjects: true,
detectionDepth: 1,
});
t.ok(spyPlugin.withArgs('rubygems').calledOnce, 'calls rubygems plugin');
t.ok(spyPlugin.withArgs('npm').calledOnce, 'calls npm plugin');
Expand Down Expand Up @@ -80,6 +81,7 @@ export const AllProjectsTests: AcceptanceTests = {

await params.cli.test('mono-repo-project', {
allProjects: true,
detectionDepth: 1,
});
const [
rubyAllProjectsBody,
Expand Down

0 comments on commit d9af224

Please sign in to comment.