allure-js-commons
Advanced tools
Comparing version 2.0.0-beta.11 to 2.0.0-beta.12
export { AllureRuntime } from "./src/AllureRuntime"; | ||
export { InMemoryAllureWriter } from "./src/writers"; | ||
export { InMemoryAllureWriter, AllureResults } from "./src/writers"; | ||
export { AllureConfig } from "./src/AllureConfig"; | ||
@@ -4,0 +4,0 @@ export { AllureGroup } from "./src/AllureGroup"; |
@@ -10,3 +10,3 @@ "use strict"; | ||
this.runtime = runtime; | ||
this.testResultContainer = constructors_1.testResultContainer(); | ||
this.testResultContainer = (0, constructors_1.testResultContainer)(); | ||
} | ||
@@ -38,3 +38,3 @@ startGroup(name) { | ||
addBefore() { | ||
const result = constructors_1.fixtureResult(); | ||
const result = (0, constructors_1.fixtureResult)(); | ||
this.testResultContainer.befores.push(result); | ||
@@ -44,3 +44,3 @@ return new ExecutableItemWrapper_1.ExecutableItemWrapper(result); | ||
addAfter() { | ||
const result = constructors_1.fixtureResult(); | ||
const result = (0, constructors_1.fixtureResult)(); | ||
this.testResultContainer.afters.push(result); | ||
@@ -47,0 +47,0 @@ return new ExecutableItemWrapper_1.ExecutableItemWrapper(result); |
/// <reference types="node" /> | ||
import { PathLike } from "fs"; | ||
import { AllureConfig } from "./AllureConfig"; | ||
@@ -13,4 +14,5 @@ import { AllureGroup } from "./AllureGroup"; | ||
writeAttachment(content: Buffer | string, options: ContentType | string | AttachmentOptions): string; | ||
writeAttachmentFromPath(filePath: PathLike, options: ContentType | string | AttachmentOptions): string; | ||
writeEnvironmentInfo(info?: Record<string, string>): void; | ||
writeCategoriesDefinitions(categories: Category[]): void; | ||
} |
@@ -7,2 +7,9 @@ "use strict"; | ||
const writers_1 = require("./writers"); | ||
const buildAttachmentFileName = (options) => { | ||
if (typeof options === "string") { | ||
options = { contentType: options }; | ||
} | ||
const extension = (0, writers_1.typeToExtension)(options); | ||
return `${(0, uuid_1.v4)()}-attachment.${extension}`; | ||
}; | ||
class AllureRuntime { | ||
@@ -28,10 +35,11 @@ constructor(config) { | ||
writeAttachment(content, options) { | ||
if (typeof options === "string") { | ||
options = { contentType: options }; | ||
} | ||
const extension = writers_1.typeToExtension(options); | ||
const fileName = `${uuid_1.v4()}-attachment.${extension}`; | ||
const fileName = buildAttachmentFileName(options); | ||
this.writer.writeAttachment(fileName, content); | ||
return fileName; | ||
} | ||
writeAttachmentFromPath(filePath, options) { | ||
const fileName = buildAttachmentFileName(options); | ||
this.writer.writeAttachmentFromPath(fileName, filePath); | ||
return fileName; | ||
} | ||
writeEnvironmentInfo(info) { | ||
@@ -38,0 +46,0 @@ this.writer.writeEnvironmentInfo(info || process.env); |
@@ -9,3 +9,3 @@ "use strict"; | ||
constructor(runtime, start = Date.now()) { | ||
super(constructors_1.testResult()); | ||
super((0, constructors_1.testResult)()); | ||
this.runtime = runtime; | ||
@@ -12,0 +12,0 @@ this.testResult = this.wrappedItem; |
@@ -8,3 +8,3 @@ "use strict"; | ||
return { | ||
uuid: uuid_1.v4(), | ||
uuid: (0, uuid_1.v4)(), | ||
children: [], | ||
@@ -40,4 +40,4 @@ befores: [], | ||
return { | ||
uuid: uuid_1.v4(), | ||
historyId: uuid_1.v4(), | ||
uuid: (0, uuid_1.v4)(), | ||
historyId: (0, uuid_1.v4)(), | ||
status: undefined, | ||
@@ -44,0 +44,0 @@ statusDetails: {}, |
@@ -7,4 +7,4 @@ import { AttachmentOptions, ContentType, FixtureResult, Stage, Status, StatusDetails, StepResult, TestResult } from "./model"; | ||
set name(name: string); | ||
set description(description: string); | ||
set descriptionHtml(descriptionHtml: string); | ||
set description(description: string | undefined); | ||
set descriptionHtml(descriptionHtml: string | undefined); | ||
set status(status: Status | undefined); | ||
@@ -11,0 +11,0 @@ get status(): Status | undefined; |
@@ -51,3 +51,3 @@ "use strict"; | ||
startStep(name, start) { | ||
const result = constructors_1.stepResult(); | ||
const result = (0, constructors_1.stepResult)(); | ||
this.info.steps.push(result); | ||
@@ -74,3 +74,3 @@ const allureStep = new AllureStep(result, start); | ||
} | ||
if (isPromise_1.isPromise(result)) { | ||
if ((0, isPromise_1.isPromise)(result)) { | ||
const promise = result; | ||
@@ -77,0 +77,0 @@ return promise |
/// <reference types="node" /> | ||
import { PathLike } from "fs"; | ||
import { Category, TestResult, TestResultContainer } from "../model"; | ||
@@ -7,4 +8,5 @@ export interface AllureWriter { | ||
writeAttachment(name: string, content: Buffer | string): void; | ||
writeAttachmentFromPath(targetFileName: string, sourceFilePath: PathLike): void; | ||
writeEnvironmentInfo(info: Record<string, string | undefined>): void; | ||
writeCategoriesDefinitions(categories: Category[]): void; | ||
} |
/// <reference types="node" /> | ||
import { PathLike } from "fs"; | ||
import { AllureConfig } from "../AllureConfig"; | ||
@@ -9,2 +10,3 @@ import { Category, TestResult, TestResultContainer } from "../model"; | ||
writeAttachment(name: string, content: Buffer | string): void; | ||
writeAttachmentFromPath(targetFileName: string, sourceFilePath: PathLike): void; | ||
writeEnvironmentInfo(info?: Record<string, string | undefined>): void; | ||
@@ -11,0 +13,0 @@ writeCategoriesDefinitions(categories: Category[]): void; |
@@ -9,3 +9,3 @@ "use strict"; | ||
const writeJson = (path, data) => { | ||
fs_1.writeFileSync(path, JSON.stringify(data), { encoding: "utf-8" }); | ||
(0, fs_1.writeFileSync)(path, JSON.stringify(data), { encoding: "utf-8" }); | ||
}; | ||
@@ -15,4 +15,4 @@ class FileSystemAllureWriter { | ||
this.config = config; | ||
if (!fs_1.existsSync(this.config.resultsDir)) { | ||
mkdirp_1.sync(this.config.resultsDir); | ||
if (!(0, fs_1.existsSync)(this.config.resultsDir)) { | ||
(0, mkdirp_1.sync)(this.config.resultsDir); | ||
} | ||
@@ -22,8 +22,12 @@ } | ||
const path = this.buildPath(name); | ||
fs_1.writeFileSync(path, content); | ||
(0, fs_1.writeFileSync)(path, content); | ||
} | ||
writeAttachmentFromPath(targetFileName, sourceFilePath) { | ||
const path = this.buildPath(targetFileName); | ||
(0, fs_1.copyFileSync)(path, sourceFilePath); | ||
} | ||
writeEnvironmentInfo(info) { | ||
const text = properties_1.stringify(info, { unicode: true }).toString(); | ||
const text = (0, properties_1.stringify)(info, { unicode: true }).toString(); | ||
const path = this.buildPath("environment.properties"); | ||
fs_1.writeFileSync(path, text); | ||
(0, fs_1.writeFileSync)(path, text); | ||
} | ||
@@ -43,3 +47,3 @@ writeCategoriesDefinitions(categories) { | ||
buildPath(name) { | ||
return path_1.join(this.config.resultsDir, name); | ||
return (0, path_1.join)(this.config.resultsDir, name); | ||
} | ||
@@ -46,0 +50,0 @@ } |
export { AllureWriter } from "./AllureWriter"; | ||
export { FileSystemAllureWriter } from "./FileSystemAllureWriter"; | ||
export { InMemoryAllureWriter } from "./InMemoryAllureWriter"; | ||
export { AllureResults } from "./InMemoryAllureWriter"; | ||
export * from "./utils"; |
/// <reference types="node" /> | ||
import { PathLike } from "fs"; | ||
import { Category, TestResult, TestResultContainer } from "../model"; | ||
import { AllureWriter } from "./AllureWriter"; | ||
export interface AllureResults { | ||
tests: TestResult[]; | ||
groups: TestResultContainer[]; | ||
attachments: Record<string, Buffer | string>; | ||
} | ||
export declare class InMemoryAllureWriter implements AllureWriter { | ||
@@ -13,2 +19,3 @@ groups: TestResultContainer[]; | ||
writeAttachment(name: string, content: Buffer | string): void; | ||
writeAttachmentFromPath(targetFileName: string, sourceFilePath: PathLike): void; | ||
writeCategoriesDefinitions(categories: Category[]): void; | ||
@@ -15,0 +22,0 @@ writeEnvironmentInfo(envInfo?: Record<string, string | undefined>): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.InMemoryAllureWriter = void 0; | ||
const fs_1 = require("fs"); | ||
class InMemoryAllureWriter { | ||
@@ -19,2 +20,5 @@ constructor() { | ||
} | ||
writeAttachmentFromPath(targetFileName, sourceFilePath) { | ||
this.attachments[targetFileName] = (0, fs_1.readFileSync)(sourceFilePath); | ||
} | ||
writeCategoriesDefinitions(categories) { | ||
@@ -21,0 +25,0 @@ if (this.categories) { |
@@ -189,3 +189,3 @@ Apache License | ||
Copyright 2019 Qameta Software | ||
Copyright 2019-2021 Qameta Software | ||
@@ -192,0 +192,0 @@ Licensed under the Apache License, Version 2.0 (the "License"); |
{ | ||
"name": "allure-js-commons", | ||
"version": "2.0.0-beta.11", | ||
"version": "2.0.0-beta.12", | ||
"description": "Allure JS Commons", | ||
@@ -15,8 +15,11 @@ "license": "Apache-2.0", | ||
"compile": "tsc", | ||
"build": "npm run lint && npm run compile", | ||
"prepublishOnly": "npm run clean && npm run build" | ||
"test": "echo 'no tests'" | ||
}, | ||
"devDependencies": { | ||
"@types/mkdirp": "^1.0.0", | ||
"@types/uuid": "^8.3.0" | ||
"@types/uuid": "^8.3.0", | ||
"eslint": "^7.32.0", | ||
"prettier": "^2.3.2", | ||
"rimraf": "^3.0.2", | ||
"typescript": "^4.4.2" | ||
}, | ||
@@ -28,3 +31,6 @@ "dependencies": { | ||
}, | ||
"gitHead": "b4fbc98075d36c9e62f7950b12086fc78266be11" | ||
} | ||
"files": [ | ||
"dist" | ||
], | ||
"stableVersion": "2.0.0-beta.11" | ||
} |
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
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
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
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
67130
978
6
3
4