{"id":19914453,"url":"https://github.com/fescobar/lighthousedotnet","last_synced_at":"2025-03-01T09:18:57.017Z","repository":{"id":96051377,"uuid":"607782461","full_name":"fescobar/LighthouseDotnet","owner":"fescobar","description":null,"archived":false,"fork":false,"pushed_at":"2023-03-04T09:08:53.000Z","size":14,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-12T10:57:15.396Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fescobar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-28T17:03:23.000Z","updated_at":"2025-01-23T14:36:50.000Z","dependencies_parsed_at":"2023-05-03T04:15:32.278Z","dependency_job_id":null,"html_url":"https://github.com/fescobar/LighthouseDotnet","commit_stats":{"total_commits":3,"total_committers":2,"mean_commits":1.5,"dds":"0.33333333333333337","last_synced_commit":"5ec1d7f1e990ce713681c329992922abfdd878eb"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fescobar%2FLighthouseDotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fescobar%2FLighthouseDotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fescobar%2FLighthouseDotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fescobar%2FLighthouseDotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fescobar","download_url":"https://codeload.github.com/fescobar/LighthouseDotnet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241342491,"owners_count":19947216,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T21:36:08.650Z","updated_at":"2025-03-01T09:18:57.010Z","avatar_url":"https://github.com/fescobar.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LighthouseDotnet\n [![Nuget](https://img.shields.io/nuget/v/LighthouseDotnet.svg)](https://www.nuget.org/packages/LighthouseDotnet)\nThis is a .net (c#) library for [Google Lighthouse](https://github.com/GoogleChrome/lighthouse) tool.\n\nLighthouse.NET analyzes web apps and web pages, collecting modern performance metrics and insights on developer best practices from your code.\n\n*Auditing, performance metrics, and best practices for Progressive Web Apps in .NET tests.*\n\nCompatible with newest version from dotnet5 and working from `Docker` containers.\n\n- Note: Project based on https://github.com/dima-horror/lighthouse.net\n\n## PRE-REQUISITES\n- Install Google Chrome https://www.google.com/chrome/\n- Install node from 18x version https://nodejs.org/en/download/\n- Install lighthouse `10.0.2` globally\n```sh\nnpm i lighthouse@10.0.2 -g\n```\n- Install lighthouse.net into your project via NuGet\n```\nPM\u003e Install-Package LighthouseDotnet\n```\n- https://www.nuget.org/packages/LighthouseDotnet\n\n## USAGE\n\n[LighthouseDotnetTests.cs](https://github.com/fescobar/LighthouseDotnet/blob/main/LighthouseDotnetTests/Tests/LighthouseDotnetTests.cs)\n\n```c#\n        [Test]\n        public async Task NpmExistTest()\n        {\n            var lh = new Lighthouse();\n            var res = await lh.Run(\"http://example.com\");\n\n            Assert.IsNotNull(res);\n            Assert.IsNotNull(res.Performance);\n            Assert.IsTrue(res.Performance \u003e 0.5m);\n\n            Assert.IsNotNull(res.Accessibility);\n            Assert.IsTrue(res.Accessibility \u003e 0.5m);\n\n            Assert.IsNotNull(res.BestPractices);\n            Assert.IsTrue(res.BestPractices \u003e 0.5m);\n\n            Assert.IsNotNull(res.Pwa);\n            Assert.IsTrue(res.Pwa \u003e 0.2m);\n\n            Assert.IsNotNull(res.Seo);\n            Assert.IsTrue(res.Seo \u003e 0.2m);\n        }\n```\n\n```c#\n        [Test]\n        public async Task GetHtmlReport()\n        {\n            var lh = new Lighthouse();\n            var res = await lh.Run(\"http://example.com\");\n\n            var reportsDir = \"./lighthouse-reports\";\n            var filename = $\"{Guid.NewGuid()}--{DateTime.Now:dd-MM-yyyy--HH-mm-ss}\";\n\n            var reportPath = lh.SaveReportHtml(reportsDir, filename, res);\n            Console.WriteLine(reportPath);\n\n            var report = File.ReadAllText(reportPath);\n            Console.WriteLine(report);\n            Assert.NotNull(report);\n        }\n```\n\n```c#\n        [Test]\n        public async Task GetCsvReport()\n        {\n            var lh = new Lighthouse();\n            var res = await lh.Run(\"http://example.com\");\n\n            var reportsDir = \"./lighthouse-reports\";\n            var filename = $\"{Guid.NewGuid()}--{DateTime.Now:dd-MM-yyyy--HH-mm-ss}\";\n\n            var reportPath = lh.SaveReportCsv(reportsDir, filename, res);\n            Console.WriteLine(reportPath);\n\n            var reportContent = File.ReadAllText(reportPath);\n            Assert.False(String.IsNullOrEmpty(reportContent.Trim()));\n        }\n```\n\n```c#\n        [Test]\n        public async Task GetJsonReport()\n        {\n            var lh = new Lighthouse();\n            var res = await lh.Run(\"http://example.com\");\n\n            var reportsDir = \"./lighthouse-reports\";\n            var filename = $\"{Guid.NewGuid()}--{DateTime.Now:dd-MM-yyyy--HH-mm-ss}\";\n\n            var reportPath = lh.SaveReportJson(reportsDir, filename, res);\n            Console.WriteLine(reportPath);\n\n            var reportContent = File.ReadAllText(reportPath);\n            Assert.False(String.IsNullOrEmpty(reportContent.Trim()));\n        }\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffescobar%2Flighthousedotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffescobar%2Flighthousedotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffescobar%2Flighthousedotnet/lists"}