allure-js-commons
Advanced tools
Comparing version 2.0.0-beta.4 to 2.0.0-beta.5
@@ -5,2 +5,4 @@ "use strict"; | ||
exports.AllureRuntime = AllureRuntime_1.AllureRuntime; | ||
var writers_1 = require("./src/writers"); | ||
exports.InMemoryAllureWriter = writers_1.InMemoryAllureWriter; | ||
var AllureConfig_1 = require("./src/AllureConfig"); | ||
@@ -27,4 +29,2 @@ exports.AllureConfig = AllureConfig_1.AllureConfig; | ||
exports.LinkType = model_1.LinkType; | ||
var InMemoryAllureRuntime_1 = require("./src/InMemoryAllureRuntime"); | ||
exports.InMemoryAllureRuntime = InMemoryAllureRuntime_1.InMemoryAllureRuntime; | ||
//# sourceMappingURL=index.js.map |
@@ -6,2 +6,5 @@ "use strict"; | ||
class Allure { | ||
constructor(runtime) { | ||
this.runtime = runtime; | ||
} | ||
epic(epic) { | ||
@@ -55,2 +58,8 @@ this.label(model_2.LabelName.EPIC, epic); | ||
} | ||
writeEnvironmentInfo(info) { | ||
this.runtime.writeEnvironmentInfo(info); | ||
} | ||
writeCategoriesDefinitions(categories) { | ||
this.runtime.writeCategoriesDefinitions(categories); | ||
} | ||
createStep(name, stepFunction) { | ||
@@ -57,0 +66,0 @@ return (...args) => this.step(name, () => stepFunction.apply(this, args)); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
class AllureConfig { | ||
constructor(resultsDir = "allure-results", testMapper) { | ||
constructor(resultsDir = "allure-results", testMapper, writer) { | ||
this.resultsDir = resultsDir; | ||
this.testMapper = testMapper; | ||
this.writer = writer; | ||
} | ||
@@ -8,0 +9,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const model_1 = require("./model"); | ||
const fs_1 = require("fs"); | ||
const mkdirp_1 = require("mkdirp"); | ||
const path_1 = require("path"); | ||
const uuid_1 = require("uuid"); | ||
const properties_1 = require("properties"); | ||
const AllureGroup_1 = require("./AllureGroup"); | ||
function typeToExtension(type) { | ||
switch (type) { | ||
case model_1.ContentType.TEXT: | ||
return "txt"; | ||
case model_1.ContentType.XML: | ||
return "xml"; | ||
case model_1.ContentType.CSV: | ||
return "csv"; | ||
case model_1.ContentType.TSV: | ||
return "tsv"; | ||
case model_1.ContentType.CSS: | ||
return "css"; | ||
case model_1.ContentType.URI: | ||
return "uri"; | ||
case model_1.ContentType.SVG: | ||
return "svg"; | ||
case model_1.ContentType.PNG: | ||
return "png"; | ||
case model_1.ContentType.JSON: | ||
return "json"; | ||
case model_1.ContentType.WEBM: | ||
return "webm"; | ||
case model_1.ContentType.JPEG: | ||
return "jpg"; | ||
} | ||
throw new Error(`Unrecognized extension: ${type}`); | ||
} | ||
const writers_1 = require("./writers"); | ||
class AllureRuntime { | ||
constructor(config) { | ||
this.config = config; | ||
if (!fs_1.existsSync(this.config.resultsDir)) { | ||
mkdirp_1.sync(this.config.resultsDir); | ||
} | ||
this.writer = config.writer || new writers_1.AllureWriter(config); | ||
} | ||
@@ -52,30 +19,19 @@ startGroup(name) { | ||
if (modifiedResult != null) { | ||
const path = path_1.join(this.config.resultsDir, `${modifiedResult.uuid}-result.json`); | ||
fs_1.writeFileSync(path, JSON.stringify(modifiedResult), { encoding: "utf-8" }); | ||
this.writer.writeResult(modifiedResult); | ||
} | ||
} | ||
writeGroup(result) { | ||
const path = path_1.join(this.config.resultsDir, `${result.uuid}-container.json`); | ||
fs_1.writeFileSync(path, JSON.stringify(result), { encoding: "utf-8" }); | ||
this.writer.writeGroup(result); | ||
} | ||
writeAttachment(content, contentType) { | ||
const extension = typeToExtension(contentType); | ||
const extension = writers_1.typeToExtension(contentType); | ||
const fileName = `${uuid_1.v4()}-attachment.${extension}`; | ||
const path = path_1.join(this.config.resultsDir, fileName); | ||
fs_1.writeFileSync(path, content, { encoding: "utf-8" }); | ||
this.writer.writeAttachment(fileName, content); | ||
return fileName; | ||
} | ||
writeExecutorInfo(info) { | ||
const path = path_1.join(this.config.resultsDir, "executor.json"); | ||
fs_1.writeFileSync(path, JSON.stringify(info), { encoding: "utf-8" }); | ||
} | ||
writeEnvironmentInfo(info) { | ||
const path = path_1.join(this.config.resultsDir, "environment.properties"); | ||
const target = info || process.env; | ||
const text = properties_1.stringify(target, { unicode: true }); | ||
fs_1.writeFileSync(path, text, { encoding: "utf-8" }); | ||
this.writer.writeEnvironmentInfo(info || process.env); | ||
} | ||
writeCategories(categories) { | ||
const path = path_1.join(this.config.resultsDir, "categories.json"); | ||
fs_1.writeFileSync(path, JSON.stringify(categories.map(c => { | ||
writeCategoriesDefinitions(categories) { | ||
const serializedCategories = categories.map(c => { | ||
if (c.messageRegex instanceof RegExp) | ||
@@ -86,3 +42,4 @@ c.messageRegex = c.messageRegex.source; | ||
return c; | ||
})), { encoding: "utf-8" }); | ||
}); | ||
this.writer.writeCategoriesDefinitions(serializedCategories); | ||
} | ||
@@ -89,0 +46,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const model_1 = require("./model"); | ||
const uuid_1 = require("uuid"); | ||
const model_1 = require("./model"); | ||
const model_2 = require("./model"); | ||
function testResultContainer() { | ||
@@ -19,3 +18,3 @@ return { | ||
statusDetails: {}, | ||
stage: model_2.Stage.PENDING, | ||
stage: model_1.Stage.PENDING, | ||
steps: [], | ||
@@ -29,5 +28,5 @@ attachments: [], | ||
return { | ||
status: model_1.Status.BROKEN, | ||
status: undefined, | ||
statusDetails: {}, | ||
stage: model_2.Stage.PENDING, | ||
stage: model_1.Stage.PENDING, | ||
steps: [], | ||
@@ -43,5 +42,5 @@ attachments: [], | ||
historyId: uuid_1.v4(), | ||
status: model_1.Status.BROKEN, | ||
status: undefined, | ||
statusDetails: {}, | ||
stage: model_2.Stage.PENDING, | ||
stage: model_1.Stage.PENDING, | ||
steps: [], | ||
@@ -48,0 +47,0 @@ attachments: [], |
@@ -25,2 +25,5 @@ "use strict"; | ||
} | ||
get status() { | ||
return this.info.status; | ||
} | ||
set statusDetails(details) { | ||
@@ -27,0 +30,0 @@ this.info.statusDetails = details; |
{ | ||
"name": "allure-js-commons", | ||
"version": "2.0.0-beta.4", | ||
"version": "2.0.0-beta.5", | ||
"description": "Allure JS Commons", | ||
@@ -9,3 +9,2 @@ "license": "Apache-2.0", | ||
"main": "./dist/index.js", | ||
"typings": "./dist/declarations/", | ||
"scripts": { | ||
@@ -28,3 +27,3 @@ "clean": "rimraf ./dist", | ||
}, | ||
"gitHead": "8dfa461802b3e82dcdcac7714edef9a5f810368b" | ||
"gitHead": "b76c1291b2857920d41e58974a58d92ed1922af7" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
60139
48
905