diff --git a/src/Cake.Yarn.Tests/YarnInstallTests.cs b/src/Cake.Yarn.Tests/YarnInstallTests.cs index 977abe3..7fae6bf 100644 --- a/src/Cake.Yarn.Tests/YarnInstallTests.cs +++ b/src/Cake.Yarn.Tests/YarnInstallTests.cs @@ -50,8 +50,8 @@ public void Install_Settings_IgnorePlatformWarnings_Should_Use_Correct_Argument_ var result = _fixture.Run(); result.Args.ShouldBe("install --ignore-platform"); - } - + } + [Fact] public void Install_Settings_IgnoreEnginesWarnings_Should_Use_Correct_Argument_Provided_In_YarnInstallSettings() { @@ -62,6 +62,16 @@ public void Install_Settings_IgnoreEnginesWarnings_Should_Use_Correct_Argument_P result.Args.ShouldBe("install --ignore-engines"); } + [Fact] + public void Install_Settings_FrozenLockfile_Should_Use_Correct_Argument_Provided_In_YarnInstallSettings() + { + _fixture.InstallSettings = s => s.WithFrozenLockfile(); + + var result = _fixture.Run(); + + result.Args.ShouldBe("install --frozen-lockfile"); + } + [Fact] public void Several_Install_Settings_Should_Use_Correct_Argument_Provided_In_YarnInstallSettings() { diff --git a/src/Cake.Yarn/YarnInstallSettings.cs b/src/Cake.Yarn/YarnInstallSettings.cs index d444f8a..6dde6f2 100644 --- a/src/Cake.Yarn/YarnInstallSettings.cs +++ b/src/Cake.Yarn/YarnInstallSettings.cs @@ -37,12 +37,17 @@ protected override void EvaluateCore(ProcessArgumentBuilder args) if (IgnoreOptional) { args.Append("--ignore-optional"); - } - + } + if (IgnoreEngines) { args.Append("--ignore-engines"); } + + if (FrozenLockfile) + { + args.Append("--frozen-lockfile"); + } } /// @@ -90,6 +95,17 @@ public YarnInstallSettings IgnoreEnginesWarnings(bool enabled = true) return this; } + /// + /// Applies the --frozen-lockfile parameter + /// + /// + /// + public YarnInstallSettings WithFrozenLockfile(bool enabled = true) + { + FrozenLockfile = enabled; + return this; + } + /// /// --production /// @@ -109,5 +125,10 @@ public YarnInstallSettings IgnoreEnginesWarnings(bool enabled = true) /// --ignore-engines /// public bool IgnoreEngines { get; internal set; } + + /// + /// --frozen-lockfile + /// + public bool FrozenLockfile { get; internal set; } } }