New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@qualweb/earl-reporter

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@qualweb/earl-reporter - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

dist/lib/best-practices.reporter.js

35

dist/index.js

@@ -6,19 +6,20 @@ 'use strict';

Object.defineProperty(exports, "__esModule", { value: true });
const lodash_1 = __importDefault(require("lodash"));
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
const act_rules_reporter_1 = __importDefault(require("./lib/act-rules.reporter"));
const html_techniques_reporter_1 = __importDefault(require("./lib/html-techniques.reporter"));
const css_techniques_reporter_1 = __importDefault(require("./lib/css-techniques.reporter"));
const best_practices_reporter_1 = __importDefault(require("./lib/best-practices.reporter"));
async function generateEarlAssertions(report, date) {
if (report.type === 'act-rules') {
return await act_rules_reporter_1.default(report, date);
switch (report.type) {
case 'act-rules':
return await act_rules_reporter_1.default(report, date);
case 'html-techniques':
return await html_techniques_reporter_1.default(report, date);
case 'css-techniques':
return await css_techniques_reporter_1.default(report, date);
case 'best-practices':
return await best_practices_reporter_1.default(report, date);
default:
throw new Error('Invalid report type');
}
else if (report.type === 'html-techniques') {
return await html_techniques_reporter_1.default(report, date);
}
else if (report.type === 'css-techniques') {
return await css_techniques_reporter_1.default(report, date);
}
else {
throw new Error('Invalid report type');
}
}

@@ -63,3 +64,9 @@ exports.generateEarlAssertions = generateEarlAssertions;

}
earlReport.graph.push(lodash_1.default.cloneDeep(testSubject));
if (report.modules['best-practices']) {
testSubject.assertions = [
...testSubject.assertions,
...(await generateEarlAssertions(report.modules['best-practices'], report.system.date))
];
}
earlReport.graph.push(cloneDeep_1.default(testSubject));
return earlReport;

@@ -75,3 +82,3 @@ }

const earlReport = await generateSingleEarlReport(report);
aggregatedReport.graph.push(lodash_1.default.cloneDeep(earlReport.graph[0]));
aggregatedReport.graph.push(cloneDeep_1.default(earlReport.graph[0]));
}

@@ -78,0 +85,0 @@ return aggregatedReport;

13

package.json
{
"name": "@qualweb/earl-reporter",
"version": "0.0.3",
"version": "0.0.4",
"description": "Qualweb earl reporter",

@@ -28,6 +28,7 @@ "main": "dist/index.js",

"devDependencies": {
"@qualweb/types": "0.0.32",
"@qualweb/types": "0.0.24",
"@types/css": "0.0.31",
"@types/htmlparser2": "^3.10.1",
"@types/lodash": "^4.14.136",
"@types/node": "^12.7.1",
"@types/lodash": "^4.14.138",
"@types/node": "^12.7.5",
"chai": "^4.2.0",

@@ -37,4 +38,4 @@ "mocha": "^6.2.0",

"request-promise": "^4.2.4",
"tslint": "^5.18.0",
"typescript": "^3.5.3"
"tslint": "^5.20.0",
"typescript": "^3.6.3"
},

@@ -41,0 +42,0 @@ "dependencies": {

@@ -15,3 +15,2 @@ # QualWeb EARL reporter

```shell

@@ -31,8 +30,8 @@ $ npm i @qualweb/get-dom-puppeteer --save

// Generate EARL assertions in case of partial report is given
const dom = await getDom('https://act-rules.github.io/pages/about/');
const report = await executeACTR(dom.parsedSourceHTML, dom.parsedProcessedHTML);
const { source, processed } = await getDom('https://act-rules.github.io/pages/about/');
const report = await executeACTR(source.html.parsed, processed.html.parsed);
const assertions = await reporter.generateEarlAssertions(report);
console.log(assertions);
// Generate full single EARL report - based on only one test subject

@@ -66,3 +65,3 @@ const dom = await getDom('https://act-rules.github.io/pages/about/');

const earlReport = await report.generateSingleEarlReport(evaluationReport);
const earlReport = await reporter.generateSingleEarlReport(evaluationReport);

@@ -69,0 +68,0 @@ console.log(earlReport);

'use strict';
import _ from 'lodash';
import cloneDeep from 'lodash/cloneDeep';
import { EvaluationReport } from '@qualweb/core';

@@ -16,12 +16,16 @@ import {

import CSSTechniquesReportToEARL from './lib/css-techniques.reporter';
import BestPracticesReportToEARL from './lib/best-practices.reporter';
async function generateEarlAssertions(report: Report, date?: string): Promise<Assertion[]> {
if (report.type === 'act-rules') {
return await ACTRulesReportToEARL(report, date);
} else if (report.type === 'html-techniques') {
return await HTMLTechniquesReportToEARL(report, date);
} else if (report.type === 'css-techniques') {
return await CSSTechniquesReportToEARL(report, date);
} else {
throw new Error('Invalid report type');
switch(report.type) {
case 'act-rules':
return await ACTRulesReportToEARL(report, date);
case 'html-techniques':
return await HTMLTechniquesReportToEARL(report, date);
case 'css-techniques':
return await CSSTechniquesReportToEARL(report, date);
case 'best-practices':
return await BestPracticesReportToEARL(report, date);
default:
throw new Error('Invalid report type');
}

@@ -71,4 +75,10 @@ }

}
if (report.modules['best-practices']) {
testSubject.assertions = [
...testSubject.assertions,
...(await generateEarlAssertions(report.modules['best-practices'], report.system.date))
];
}
earlReport.graph.push(_.cloneDeep(testSubject));
earlReport.graph.push(cloneDeep(testSubject));

@@ -86,3 +96,3 @@ return earlReport;

const earlReport = await generateSingleEarlReport(report);
aggregatedReport.graph.push(_.cloneDeep(earlReport.graph[0]));
aggregatedReport.graph.push(cloneDeep(earlReport.graph[0]));
}

@@ -89,0 +99,0 @@

@@ -45,3 +45,3 @@ {

"typeRoots": ["./node_modules/@qualweb/types"], /* List of folders to include type definitions from. */
"types": ["./node_modules/@qualweb/types", "node", "htmlparser2", "lodash"], /* Type declaration files to be included in compilation. */
"types": ["./node_modules/@qualweb/types", "node", "htmlparser2", "lodash", "css"], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */

@@ -48,0 +48,0 @@ "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */

Sorry, the diff of this file is not supported yet

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