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

@empiricalrun/reporter

Package Overview
Dependencies
Maintainers
0
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@empiricalrun/reporter - npm Package Compare versions

Comparing version 0.17.1 to 0.17.2

6

CHANGELOG.md
# @empiricalrun/reporter
## 0.17.2
### Patch Changes
- b6a7231: fix: throw error in appium when allure report doesn't exist
## 0.17.1

@@ -4,0 +10,0 @@

1

dist/sources/appium/index.d.ts

@@ -11,2 +11,3 @@ import { BaseReportSource, FailedTestWithLink, Platform, ReportFilter, Results } from "../base";

getSummaryReportUrl(): string;
private setReport;
reportExists(): Promise<boolean>;

@@ -13,0 +14,0 @@ resultsSummary(): Results;

@@ -14,2 +14,3 @@ "use strict";

this.platformName = platformName;
this.setReport();
}

@@ -22,7 +23,18 @@ platform() {

}
setReport() {
try {
this.report = (0, utils_1.generateJsonFile)();
}
catch (e) {
console.error("failed to generate Appium JSON --->", e);
this.report = undefined;
}
}
async reportExists() {
this.report = await (0, utils_1.generateJsonFile)();
return this.report !== undefined;
}
resultsSummary() {
if (!this.report) {
throw Error(`No allure report found at given path: ${utils_1.allureReportDirectoryPath}`);
}
const hasPassed = this.report?.summary.failed === 0 && this.report?.summary.broken === 0;

@@ -29,0 +41,0 @@ return {

3

dist/sources/appium/utils.d.ts
import { AppiumReport } from "./types";
export declare function generateJsonFile(): Promise<AppiumReport>;
export declare const allureReportDirectoryPath: string;
export declare function generateJsonFile(): AppiumReport;
//# sourceMappingURL=utils.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateJsonFile = void 0;
const fast_xml_parser_1 = require("fast-xml-parser");
exports.generateJsonFile = exports.allureReportDirectoryPath = void 0;
const fs_1 = require("fs");
const path_1 = require("path");
const directoryPath = (0, path_1.join)(process.cwd(), "allure-results"); // Directory containing the XML files
function extractTestCaseDetails(xml) {
const parser = new fast_xml_parser_1.XMLParser({
ignoreAttributes: false,
attributeNamePrefix: "",
});
const result = parser.parse(xml);
const testCases = result["ns2:test-suite"]["test-cases"]["test-case"];
const testCaseArray = Array.isArray(testCases) ? testCases : [testCases];
return testCaseArray.map((testCase) => {
const start = parseInt(testCase.start);
const stop = parseInt(testCase.stop);
return {
name: testCase.name,
status: testCase.status,
start,
stop,
flake: false,
testCaseId: testCase.testCaseId,
};
});
}
async function processXmlFiles() {
const files = (0, fs_1.readdirSync)(directoryPath);
let allTestCases = [];
for (const file of files) {
if (file.endsWith(".xml")) {
const filePath = (0, path_1.join)(directoryPath, file);
const xmlContent = (0, fs_1.readFileSync)(filePath, "utf-8");
const testCases = extractTestCaseDetails(xmlContent);
allTestCases = allTestCases.concat(testCases);
}
}
return allTestCases;
}
exports.allureReportDirectoryPath = (0, path_1.join)(process.cwd(), "allure-results"); // Directory containing the XML files
function modifyTestsToHandleFlakyCases(testCases) {

@@ -96,19 +61,8 @@ let modifiedTests = [];

}
function allureReportVersion() {
const pkgJson = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(process.cwd(), "package.json"), "utf-8"));
const dependencies = { ...pkgJson.dependencies, ...pkgJson.devDependencies };
const allureVersion = dependencies["@wdio/allure-reporter"];
if (allureVersion.includes("^8.")) {
return "8";
}
else {
return "7";
}
}
async function processJsonFiles() {
const files = (0, fs_1.readdirSync)(directoryPath);
function processJsonFiles() {
const files = (0, fs_1.readdirSync)(exports.allureReportDirectoryPath);
let allTestCases = [];
for (const file of files) {
if (file.endsWith("-result.json")) {
const filePath = (0, path_1.join)(directoryPath, file);
const filePath = (0, path_1.join)(exports.allureReportDirectoryPath, file);
const jsonContent = JSON.parse((0, fs_1.readFileSync)(filePath, "utf-8"));

@@ -120,11 +74,4 @@ allTestCases = allTestCases.concat(jsonContent);

}
async function generateJsonFile() {
const allureVersion = allureReportVersion();
let testCases = [];
if (allureVersion === "7") {
testCases = await processXmlFiles();
}
else {
testCases = await processJsonFiles();
}
function generateJsonFile() {
let testCases = processJsonFiles();
testCases = modifyTestsToHandleFlakyCases(testCases);

@@ -131,0 +78,0 @@ return parsedSummary(testCases);

{
"name": "@empiricalrun/reporter",
"version": "0.17.1",
"version": "0.17.2",
"publishConfig": {

@@ -23,4 +23,3 @@ "registry": "https://registry.npmjs.org/",

"@slack/webhook": "^7.0.2",
"date-fns": "^3.6.0",
"fast-xml-parser": "^4.4.0"
"date-fns": "^3.6.0"
},

@@ -27,0 +26,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

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