@@ -7,7 +7,9 @@ use beachball::options::get_options::get_parsed_options_for_test;
77use beachball:: types:: options:: { BeachballOptions , CliOptions } ;
88use common:: change_files:: generate_change_files;
99use common:: repository_factory:: RepositoryFactory ;
10- use common:: { DEFAULT_BRANCH , DEFAULT_REMOTE_BRANCH } ;
10+ use common:: {
11+ DEFAULT_BRANCH , DEFAULT_REMOTE_BRANCH , capture_logging, get_log_output, reset_logging,
12+ } ;
1113use serde_json:: json;
1214use std:: collections:: HashMap ;
1315
@@ -55,9 +57,18 @@ fn returns_package_name_when_changes_in_branch() {
5557 check_out_test_branch ( & repo, "changes_in_branch" ) ;
5658 repo. commit_change ( "packages/foo/myFilename" ) ;
5759
58- let ( options, infos, scoped) = get_options_and_packages ( & repo, None , None ) ;
60+ let opts = BeachballOptions {
61+ verbose : true ,
62+ ..Default :: default ( )
63+ } ;
64+ capture_logging ( ) ;
65+ let ( options, infos, scoped) = get_options_and_packages ( & repo, Some ( opts) , None ) ;
5966 let result = get_changed_packages ( & options, & infos, & scoped) . unwrap ( ) ;
67+ let output = get_log_output ( ) ;
68+ reset_logging ( ) ;
69+
6070 assert_eq ! ( result, vec![ "foo" ] ) ;
71+ assert ! ( output. contains( "Checking for changes against" ) ) ;
6172}
6273
6374#[ test]
@@ -154,8 +165,13 @@ fn respects_ignore_patterns() {
154165 repo. write_file_content ( "yarn.lock" , "changed" ) ;
155166 repo. git ( & [ "add" , "-A" ] ) ;
156167
168+ capture_logging ( ) ;
157169 let result = get_changed_packages ( & options, & infos, & scoped) . unwrap ( ) ;
170+ let output = get_log_output ( ) ;
171+ reset_logging ( ) ;
172+
158173 assert ! ( result. is_empty( ) ) ;
174+ assert ! ( output. contains( "ignored by pattern" ) ) ;
159175}
160176
161177// ===== Monorepo tests =====
@@ -191,8 +207,13 @@ fn excludes_packages_with_existing_change_files() {
191207 let ( options, infos, scoped) = get_options_and_packages ( & repo, Some ( opts) , None ) ;
192208 generate_change_files ( & [ "foo" ] , & options, & repo) ;
193209
210+ capture_logging ( ) ;
194211 let result = get_changed_packages ( & options, & infos, & scoped) . unwrap ( ) ;
212+ let output = get_log_output ( ) ;
213+ reset_logging ( ) ;
214+
195215 assert ! ( result. is_empty( ) , "Expected empty but got: {result:?}" ) ;
216+ assert ! ( output. contains( "already has change files for these packages" ) ) ;
196217
197218 // Change bar => bar is the only changed package returned
198219 repo. stage_change ( "packages/bar/test.js" ) ;
@@ -249,9 +270,15 @@ fn ignores_package_changes_as_appropriate() {
249270 ..Default :: default ( )
250271 } ;
251272
273+ capture_logging ( ) ;
252274 let ( options, infos, scoped) = get_options_and_packages ( & repo, Some ( opts) , None ) ;
253275 let result = get_changed_packages ( & options, & infos, & scoped) . unwrap ( ) ;
276+ let output = get_log_output ( ) ;
277+ reset_logging ( ) ;
278+
254279 assert_eq ! ( result, vec![ "publish-me" ] ) ;
280+ assert ! ( output. contains( "is private" ) ) ;
281+ assert ! ( output. contains( "is out of scope" ) ) ;
255282}
256283
257284#[ test]
0 commit comments