LighthouseDotnet 15.0.0

dotnet add package LighthouseDotnet --version 15.0.0
NuGet\Install-Package LighthouseDotnet -Version 15.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LighthouseDotnet" Version="15.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LighthouseDotnet --version 15.0.0
#r "nuget: LighthouseDotnet, 15.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install LighthouseDotnet as a Cake Addin
#addin nuget:?package=LighthouseDotnet&version=15.0.0

// Install LighthouseDotnet as a Cake Tool
#tool nuget:?package=LighthouseDotnet&version=15.0.0

LighthouseDotnet

Nuget This is a .net (c#) library for Google Lighthouse tool.

Lighthouse.NET analyzes web apps and web pages, collecting modern performance metrics and insights on developer best practices from your code.

Auditing, performance metrics, and best practices for Progressive Web Apps in .NET tests.

Compatible with newest version from dotnet5 and working from Docker containers.

PRE-REQUISITES

npm i lighthouse@10.0.2 -g
  • Install lighthouse.net into your project via NuGet
PM> Install-Package LighthouseDotnet

USAGE

LighthouseDotnetTests.cs

        [Test]
        public async Task NpmExistTest()
        {
            var lh = new Lighthouse();
            var res = await lh.Run("http://example.com");

            Assert.IsNotNull(res);
            Assert.IsNotNull(res.Performance);
            Assert.IsTrue(res.Performance > 0.5m);

            Assert.IsNotNull(res.Accessibility);
            Assert.IsTrue(res.Accessibility > 0.5m);

            Assert.IsNotNull(res.BestPractices);
            Assert.IsTrue(res.BestPractices > 0.5m);

            Assert.IsNotNull(res.Pwa);
            Assert.IsTrue(res.Pwa > 0.2m);

            Assert.IsNotNull(res.Seo);
            Assert.IsTrue(res.Seo > 0.2m);
        }
        [Test]
        public async Task GetHtmlReport()
        {
            var lh = new Lighthouse();
            var res = await lh.Run("http://example.com");

            var reportsDir = "./lighthouse-reports";
            var filename = $"{Guid.NewGuid()}--{DateTime.Now:dd-MM-yyyy--HH-mm-ss}";

            var reportPath = lh.SaveReportHtml(reportsDir, filename, res);
            Console.WriteLine(reportPath);

            var report = File.ReadAllText(reportPath);
            Console.WriteLine(report);
            Assert.NotNull(report);
        }
        [Test]
        public async Task GetCsvReport()
        {
            var lh = new Lighthouse();
            var res = await lh.Run("http://example.com");

            var reportsDir = "./lighthouse-reports";
            var filename = $"{Guid.NewGuid()}--{DateTime.Now:dd-MM-yyyy--HH-mm-ss}";

            var reportPath = lh.SaveReportCsv(reportsDir, filename, res);
            Console.WriteLine(reportPath);

            var reportContent = File.ReadAllText(reportPath);
            Assert.False(String.IsNullOrEmpty(reportContent.Trim()));
        }
        [Test]
        public async Task GetJsonReport()
        {
            var lh = new Lighthouse();
            var res = await lh.Run("http://example.com");

            var reportsDir = "./lighthouse-reports";
            var filename = $"{Guid.NewGuid()}--{DateTime.Now:dd-MM-yyyy--HH-mm-ss}";

            var reportPath = lh.SaveReportJson(reportsDir, filename, res);
            Console.WriteLine(reportPath);

            var reportContent = File.ReadAllText(reportPath);
            Assert.False(String.IsNullOrEmpty(reportContent.Trim()));
        }
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
15.0.0 29,510 3/3/2023