Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@genexus/lighthouse-inspector

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@genexus/lighthouse-inspector - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

analyzer.js

@@ -10,3 +10,3 @@ function evalExpectation (expectedScore, score) {

module.exports = function (results, expectations){
module.exports = function (results, expectations = {}){
let error = false;

@@ -13,0 +13,0 @@ let messages = [];

@@ -46,2 +46,3 @@ # Configuration

| lighthouseParams | <code>Object&#124;undefined</code> |
| failOnUnmetExpectation | <code>boolean</code> |

@@ -74,1 +75,5 @@ ### `pages: string[]`

| flags | <code>Object</code> | An object containing Lighthouse flags, as specified in the [Lighthouse CLI options](https://github.com/GoogleChrome/lighthouse#cli-options) |
### `failOnUnmetExpectation: boolean`
The `failOnUnmetExpectation` property indicates whether the program will return with an error code when an expectation is unmet. Defaults to `false`.

@@ -25,15 +25,15 @@ const path = require('path');

function inspectPages (pending, expectations = {}, lighthouseParams = {}) {
function inspectPages (pending, opts) {
if (pending.length > 0) {
const [url] = pending;
const { flags, config } = lighthouseParams;
const { expectations, lighthouseParams = {} } = opts;
console.log(`Running lighthouse test on ${url}`);
launchChromeAndRunLighthouse(url, flags, config).then(results => {
launchChromeAndRunLighthouse(url, lighthouseParams.flags, lighthouseParams.config).then(results => {
const analyzerResult = analyzer(results, expectations);
if (analyzerResult.error) {
if (opts.failOnUnmetExpectation && analyzerResult.error) {
process.exitCode = 1;
}
logAnalyzerResult(analyzerResult);
inspectPages(pending.slice(1), expectations, lighthouseParams);
inspectPages(pending.slice(1), opts);
});

@@ -44,4 +44,4 @@ }

module.exports = (configPath) => {
const config = JSON.parse(fs.readFileSync(configPath));
const { pages, expectations, lighthouseParams } = config;
const opts = JSON.parse(fs.readFileSync(configPath));
const { pages } = opts;

@@ -52,3 +52,3 @@ if (pages.length === 0) {

}
return inspectPages(pages, expectations, lighthouseParams);
return inspectPages(pages, opts);
};
{
"name": "@genexus/lighthouse-inspector",
"version": "1.0.0",
"version": "1.0.1",
"description": "Run Google Lighthouse on a set of URLs, specifying expectations",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -13,4 +13,6 @@ # lighthouse-inspector

```
```sh
npm install -g @genexus/lighthouse-inspector
# or
npm install --save-dev @genexus/lighthouse-inspector
```

@@ -26,3 +28,3 @@

When an expected score isn't met, a message explaining the error is shown and the program returns with an error.
When an expected score isn't met, a message explaining which category or audit didn't meet the expected score.

@@ -29,0 +31,0 @@ ## Running the tests

@@ -24,3 +24,4 @@ {

}
}
},
"failOnUnmetExpectation": false
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc