Esempio n. 1
0
        public void Custom_LogLevel_Should_Be_Applied(NpmLogLevel logLevel, string args)
        {
            fixture.WithLogLevel(logLevel);

            var result = this.fixture.Run();

            result.Args.ShouldBe($"install {args}");
        }
Esempio n. 2
0
        /// <summary>
        /// Sets the log level which should be used to run the npm command.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="logLevel">Log level which should be used to run the npm command.</param>
        /// <returns>The <paramref name="settings"/> instance with <see cref="NpmSettings.LogLevel"/> set to <paramref name="logLevel"/>.</returns>
        public static NpmSettings WithLogLevel(this NpmSettings settings, NpmLogLevel logLevel)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            settings.LogLevel = logLevel;

            return(settings);
        }
            public void Should_Set_LogLevel(NpmLogLevel logLevel)
            {
                // Given
                var settings = new NpmInstallSettings();

                // When
                settings.WithLogLevel(logLevel);

                // Then
                settings.LogLevel.ShouldBe(logLevel);
            }
Esempio n. 4
0
            public void Should_Add_LogLevel_To_Arguments_If_Not_Null(
                NpmLogLevel logLevel,
                string expected)
            {
                // Given
                var fixture = new NpmPackerFixture();

                fixture.Settings.LogLevel = logLevel;

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal(expected, result.Args);
            }
Esempio n. 5
0
        private void AppendLogLevel(ProcessArgumentBuilder args, NpmLogLevel logLevel)
        {
            if (logLevel == NpmLogLevel.Default && CakeVerbosityLevel.HasValue)
            {
                logLevel = CakeToNpmLogLevelConverter(CakeVerbosityLevel.Value);
            }

            switch (logLevel)
            {
            case NpmLogLevel.Default:
                break;

            case NpmLogLevel.Silent:
                args.Append("--silent");
                break;

            case NpmLogLevel.Warn:
                args.Append("--warn");
                break;

            case NpmLogLevel.Info:
                args.Append("--loglevel info");
                break;

            case NpmLogLevel.Verbose:
                args.Append("--loglevel verbose");
                break;

            case NpmLogLevel.Silly:
                args.Append("--loglevel silly");
                break;

            case NpmLogLevel.Error:
                args.Append("--loglevel error");
                break;

            case NpmLogLevel.Http:
                args.Append("--loglevel http");
                break;
            }
        }
Esempio n. 6
0
 /// <summary>
 /// Sets the npm logging level
 /// </summary>
 /// <param name="logLevel"></param>
 /// <returns></returns>
 public INpmRunnerConfiguration WithLogLevel(NpmLogLevel logLevel)
 {
     _logLevel = logLevel;
     return(this);
 }
 public NpmRunnerFixture WithLogLevel(NpmLogLevel npmLogLevel)
 {
     _npmLogLevel = npmLogLevel;
     return(this);
 }