@@ -362,7 +362,7 @@ fn get_changelog_from_tag_to_tagged_head() -> Result<()> {
362362}
363363
364364#[ sealed_test]
365- fn get_changelog_whith_custom_template ( ) ->Result < ( ) > {
365+ fn get_changelog_with_custom_template ( ) ->Result < ( ) > {
366366// Arrange
367367let crate_dir =env ! ( "CARGO_MANIFEST_DIR" ) ;
368368let template =PathBuf :: from ( crate_dir) . join ( "tests/cog_tests/template.md" ) ;
@@ -437,3 +437,66 @@ fn get_changelog_whith_custom_template() -> Result<()> {
437437) ;
438438Ok ( ( ) )
439439}
440+
441+ #[ sealed_test]
442+ /// Test that the `omit_from_changelog` configuration
443+ /// directive is honored if/when it is specified for
444+ /// a given commit type.
445+ fn ensure_omit_from_changelog_is_honored ( ) ->Result < ( ) > {
446+ // Arrange
447+ git_init ( ) ?;
448+
449+ let cog_toml =indoc ! (
450+ "[changelog]
451+ remote =\" github.com\"
452+ repository =\" test\"
453+ owner =\" test\"
454+
455+ [commit_types]
456+ wip = { changelog_title =\" Work In Progress\" , omit_from_changelog = false }"
457+ ) ;
458+
459+ let _setup =(
460+ run_cmd ! ( echo $cog_toml > cog. toml; ) ?,
461+ fs:: read_to_string ( "cog.toml" ) ?,
462+ git_commit ( "chore: init" ) ?,
463+ git_commit ( "wip(some-scope): getting there" ) ?,
464+ git_tag ( "1.0.0" ) ?,
465+ ) ;
466+
467+ let changelog =Command :: cargo_bin ( "cog" ) ?
468+ . arg ( "changelog" )
469+ // Assert
470+ . assert ( )
471+ . success ( ) ;
472+
473+ let changelog = changelog. get_output ( ) ;
474+ let changelog =String :: from_utf8_lossy ( & changelog. stdout ) ;
475+
476+ assert ! (
477+ changelog. as_ref( ) . contains( "#### Work In Progress" ) ,
478+ "Expected changelog to contain a\" Work In Progress\" entry but got:\n \n {}" ,
479+ changelog. as_ref( )
480+ ) ;
481+
482+ let cog_toml = cog_toml. replace ( "omit_from_changelog = false" , "omit_from_changelog = true" ) ;
483+
484+ run_cmd ! ( echo $cog_toml > cog. toml; ) ?;
485+
486+ let changelog =Command :: cargo_bin ( "cog" ) ?
487+ . arg ( "changelog" )
488+ // Assert
489+ . assert ( )
490+ . success ( ) ;
491+
492+ let changelog = changelog. get_output ( ) ;
493+ let changelog =String :: from_utf8_lossy ( & changelog. stdout ) ;
494+
495+ assert ! (
496+ !changelog. as_ref( ) . contains( "#### Work In Progress" ) ,
497+ "Expected\" Work In Progress\" entry to be omitted from changelog but got:\n \n {}" ,
498+ changelog. as_ref( )
499+ ) ;
500+
501+ Ok ( ( ) )
502+ }