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

allure-js-commons

Package Overview
Dependencies
Maintainers
0
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

allure-js-commons - npm Package Compare versions

Comparing version 3.0.0-beta.5 to 3.0.0-beta.6

6

dist/cjs/facade.js

@@ -6,3 +6,3 @@ "use strict";

});
exports.tms = exports.testCaseId = exports.tags = exports.tag = exports.suite = exports.subSuite = exports.story = exports.step = exports.severity = exports.parentSuite = exports.parameter = exports.owner = exports.links = exports.link = exports.layer = exports.labels = exports.label = exports.issue = exports.historyId = exports.feature = exports.epic = exports.displayName = exports.descriptionHtml = exports.description = exports.attachmentPath = exports.attachment = exports.allureId = void 0;
exports.tms = exports.testCaseId = exports.tags = exports.tag = exports.suite = exports.subSuite = exports.story = exports.step = exports.severity = exports.parentSuite = exports.parameter = exports.owner = exports.logStep = exports.links = exports.link = exports.layer = exports.labels = exports.label = exports.issue = exports.historyId = exports.feature = exports.epic = exports.displayName = exports.descriptionHtml = exports.description = exports.attachmentPath = exports.attachment = exports.allureId = void 0;
var _model = require("./model.js");

@@ -98,2 +98,6 @@ var _runtime = require("./sdk/runtime/runtime.js");

});
var logStep = (name, status, error) => {
return callRuntimeMethod("logStep", name, status, error);
};
exports.logStep = logStep;
var step = (name, body) => {

@@ -100,0 +104,0 @@ return callRuntimeMethod("step", name, () => body(stepContext()));

@@ -138,2 +138,8 @@ "use strict";

});
Object.defineProperty(exports, "logStep", {
enumerable: true,
get: function get() {
return _facade.logStep;
}
});
Object.defineProperty(exports, "owner", {

@@ -140,0 +146,0 @@ enumerable: true,

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

var _writeContainer = /*#__PURE__*/new WeakMap();
var _calculateTimings = /*#__PURE__*/new WeakMap();
class ReporterRuntime {

@@ -146,3 +147,3 @@ constructor(_ref) {

});
_defineProperty(this, "stopFixture", (uuid, stop) => {
_defineProperty(this, "stopFixture", (uuid, opts) => {
var fixture = this.state.getFixtureResult(uuid);

@@ -154,3 +155,5 @@ if (!fixture) {

}
fixture.stop = stop !== null && stop !== void 0 ? stop : Date.now();
var startStop = _classPrivateFieldGet(_calculateTimings, this).call(this, fixture.start, opts === null || opts === void 0 ? void 0 : opts.stop, opts === null || opts === void 0 ? void 0 : opts.duration);
fixture.start = startStop.start;
fixture.stop = startStop.stop;
fixture.stage = _model.Stage.FINISHED;

@@ -189,3 +192,3 @@ });

});
_defineProperty(this, "stopTest", (uuid, stop) => {
_defineProperty(this, "stopTest", (uuid, opts) => {
var _testResult$testCaseI, _testResult$historyId;

@@ -201,3 +204,5 @@ var testResult = this.state.getTestResult(uuid);

(_testResult$historyId = testResult.historyId) !== null && _testResult$historyId !== void 0 ? _testResult$historyId : testResult.historyId = (0, _utils.getTestResultHistoryId)(testResult);
testResult.stop = stop !== null && stop !== void 0 ? stop : Date.now();
var startStop = _classPrivateFieldGet(_calculateTimings, this).call(this, testResult.start, opts === null || opts === void 0 ? void 0 : opts.stop, opts === null || opts === void 0 ? void 0 : opts.duration);
testResult.start = startStop.start;
testResult.stop = startStop.stop;
this.notifier.afterTestResultStop(testResult);

@@ -249,3 +254,3 @@ });

});
_defineProperty(this, "stopStep", (uuid, stop) => {
_defineProperty(this, "stopStep", (uuid, opts) => {
var step = this.state.getStepResult(uuid);

@@ -258,3 +263,5 @@ if (!step) {

this.notifier.beforeStepStop(step);
step.stop = stop !== null && stop !== void 0 ? stop : Date.now();
var startStop = _classPrivateFieldGet(_calculateTimings, this).call(this, step.start, opts === null || opts === void 0 ? void 0 : opts.stop, opts === null || opts === void 0 ? void 0 : opts.duration);
step.start = startStop.start;
step.stop = startStop.stop;
step.stage = _model.Stage.FINISHED;

@@ -423,3 +430,5 @@ this.stepStack.removeStep(uuid);

});
this.stopStep(stepUuid, message.stop);
this.stopStep(stepUuid, {
stop: message.stop
});
});

@@ -485,2 +494,27 @@ _classPrivateFieldInitSpec(this, _handleAttachmentContentMessage, (rootUuid, message) => {

});
_classPrivateFieldInitSpec(this, _calculateTimings, (start, stop, duration) => {
var result = {
start,
stop
};
if (duration) {
var normalisedDuration = Math.max(0, duration);
if (result.stop !== undefined) {
result.start = result.stop - normalisedDuration;
} else if (result.start !== undefined) {
result.stop = result.start + normalisedDuration;
} else {
result.stop = Date.now();
result.start = result.stop - normalisedDuration;
}
} else {
if (result.stop === undefined) {
result.stop = Date.now();
}
if (result.start === undefined) {
result.start = result.stop;
}
}
return result;
});
this.writer = (0, _loader.resolveWriter)(writer);

@@ -487,0 +521,0 @@ this.notifier = new _Notifier.Notifier({

40

dist/cjs/sdk/runtime/MessageTestRuntime.js

@@ -179,5 +179,9 @@ "use strict";

}
step(name, body) {
var _this13 = this;
logStep(name) {
var _arguments3 = arguments,
_this13 = this;
return _asyncToGenerator(function* () {
var status = _arguments3.length > 1 && _arguments3[1] !== undefined ? _arguments3[1] : _model.Status.PASSED;
var error = _arguments3.length > 2 ? _arguments3[2] : undefined;
var timestamp = Date.now();
yield _this13.sendMessage({

@@ -187,2 +191,22 @@ type: "step_start",

name,
start: timestamp
}
});
yield _this13.sendMessage({
type: "step_stop",
data: {
status: status,
stop: timestamp,
statusDetails: error ? _objectSpread({}, (0, _utils.getMessageAndTraceFromError)(error)) : undefined
}
});
})();
}
step(name, body) {
var _this14 = this;
return _asyncToGenerator(function* () {
yield _this14.sendMessage({
type: "step_start",
data: {
name,
start: Date.now()

@@ -193,3 +217,3 @@ }

var result = yield body();
yield _this13.sendMessage({
yield _this14.sendMessage({
type: "step_stop",

@@ -207,3 +231,3 @@ data: {

} = err;
yield _this13.sendMessage({
yield _this14.sendMessage({
type: "step_stop",

@@ -224,5 +248,5 @@ data: {

stepDisplayName(name) {
var _this14 = this;
var _this15 = this;
return _asyncToGenerator(function* () {
yield _this14.sendMessage({
yield _this15.sendMessage({
type: "step_metadata",

@@ -236,5 +260,5 @@ data: {

stepParameter(name, value, mode) {
var _this15 = this;
var _this16 = this;
return _asyncToGenerator(function* () {
yield _this15.sendMessage({
yield _this16.sendMessage({
type: "step_metadata",

@@ -241,0 +265,0 @@ data: {

@@ -64,16 +64,16 @@ "use strict";

}
step(name, body) {
logStep() {
var _this10 = this;
return _asyncToGenerator(function* () {
yield _this10.warning();
return body();
})();
}
stepDisplayName() {
step(name, body) {
var _this11 = this;
return _asyncToGenerator(function* () {
yield _this11.warning();
return body();
})();
}
stepParameter() {
stepDisplayName() {
var _this12 = this;

@@ -84,3 +84,3 @@ return _asyncToGenerator(function* () {

}
testCaseId() {
stepParameter() {
var _this13 = this;

@@ -91,2 +91,8 @@ return _asyncToGenerator(function* () {

}
testCaseId() {
var _this14 = this;
return _asyncToGenerator(function* () {
yield _this14.warning();
})();
}

@@ -93,0 +99,0 @@ // eslint-disable-next-line @typescript-eslint/require-await

@@ -81,2 +81,5 @@ import { LabelName, LinkType } from "./model.js";

});
export var logStep = (name, status, error) => {
return callRuntimeMethod("logStep", name, status, error);
};
export var step = (name, body) => {

@@ -83,0 +86,0 @@ return callRuntimeMethod("step", name, () => body(stepContext()));

@@ -1,3 +0,3 @@

export { allureId, attachment, attachmentPath, description, descriptionHtml, displayName, epic, feature, historyId, issue, label, labels, layer, link, links, owner, parameter, parentSuite, severity, step, story, subSuite, suite, tag, tags, testCaseId, tms } from "./facade.js";
export { allureId, attachment, attachmentPath, description, descriptionHtml, displayName, epic, feature, historyId, issue, label, labels, layer, link, links, logStep, owner, parameter, parentSuite, severity, step, story, subSuite, suite, tag, tags, testCaseId, tms } from "./facade.js";
export { ContentType, LinkType, LabelName, Severity, Stage, Status, StatusByPriority } from "./model.js";
//# sourceMappingURL=index.js.map

@@ -76,2 +76,3 @@ var _excluded = ["links", "labels", "parameters", "displayName"];

var _writeContainer = /*#__PURE__*/new WeakMap();
var _calculateTimings = /*#__PURE__*/new WeakMap();
export class ReporterRuntime {

@@ -141,3 +142,3 @@ constructor(_ref) {

});
_defineProperty(this, "stopFixture", (uuid, stop) => {
_defineProperty(this, "stopFixture", (uuid, opts) => {
var fixture = this.state.getFixtureResult(uuid);

@@ -149,3 +150,5 @@ if (!fixture) {

}
fixture.stop = stop !== null && stop !== void 0 ? stop : Date.now();
var startStop = _classPrivateFieldGet(_calculateTimings, this).call(this, fixture.start, opts === null || opts === void 0 ? void 0 : opts.stop, opts === null || opts === void 0 ? void 0 : opts.duration);
fixture.start = startStop.start;
fixture.stop = startStop.stop;
fixture.stage = Stage.FINISHED;

@@ -184,3 +187,3 @@ });

});
_defineProperty(this, "stopTest", (uuid, stop) => {
_defineProperty(this, "stopTest", (uuid, opts) => {
var _testResult$testCaseI, _testResult$historyId;

@@ -196,3 +199,5 @@ var testResult = this.state.getTestResult(uuid);

(_testResult$historyId = testResult.historyId) !== null && _testResult$historyId !== void 0 ? _testResult$historyId : testResult.historyId = getTestResultHistoryId(testResult);
testResult.stop = stop !== null && stop !== void 0 ? stop : Date.now();
var startStop = _classPrivateFieldGet(_calculateTimings, this).call(this, testResult.start, opts === null || opts === void 0 ? void 0 : opts.stop, opts === null || opts === void 0 ? void 0 : opts.duration);
testResult.start = startStop.start;
testResult.stop = startStop.stop;
this.notifier.afterTestResultStop(testResult);

@@ -244,3 +249,3 @@ });

});
_defineProperty(this, "stopStep", (uuid, stop) => {
_defineProperty(this, "stopStep", (uuid, opts) => {
var step = this.state.getStepResult(uuid);

@@ -253,3 +258,5 @@ if (!step) {

this.notifier.beforeStepStop(step);
step.stop = stop !== null && stop !== void 0 ? stop : Date.now();
var startStop = _classPrivateFieldGet(_calculateTimings, this).call(this, step.start, opts === null || opts === void 0 ? void 0 : opts.stop, opts === null || opts === void 0 ? void 0 : opts.duration);
step.start = startStop.start;
step.stop = startStop.stop;
step.stage = Stage.FINISHED;

@@ -418,3 +425,5 @@ this.stepStack.removeStep(uuid);

});
this.stopStep(stepUuid, message.stop);
this.stopStep(stepUuid, {
stop: message.stop
});
});

@@ -480,2 +489,27 @@ _classPrivateFieldInitSpec(this, _handleAttachmentContentMessage, (rootUuid, message) => {

});
_classPrivateFieldInitSpec(this, _calculateTimings, (start, stop, duration) => {
var result = {
start,
stop
};
if (duration) {
var normalisedDuration = Math.max(0, duration);
if (result.stop !== undefined) {
result.start = result.stop - normalisedDuration;
} else if (result.start !== undefined) {
result.stop = result.start + normalisedDuration;
} else {
result.stop = Date.now();
result.start = result.stop - normalisedDuration;
}
} else {
if (result.stop === undefined) {
result.stop = Date.now();
}
if (result.start === undefined) {
result.start = result.stop;
}
}
return result;
});
this.writer = resolveWriter(writer);

@@ -482,0 +516,0 @@ this.notifier = new Notifier({

@@ -9,3 +9,3 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }

import { Status } from "../../model.js";
import { getStatusFromError } from "../utils.js";
import { getMessageAndTraceFromError, getStatusFromError } from "../utils.js";
export class MessageTestRuntime {

@@ -174,5 +174,9 @@ label(name, value) {

}
step(name, body) {
var _this13 = this;
logStep(name) {
var _arguments3 = arguments,
_this13 = this;
return _asyncToGenerator(function* () {
var status = _arguments3.length > 1 && _arguments3[1] !== undefined ? _arguments3[1] : Status.PASSED;
var error = _arguments3.length > 2 ? _arguments3[2] : undefined;
var timestamp = Date.now();
yield _this13.sendMessage({

@@ -182,2 +186,22 @@ type: "step_start",

name,
start: timestamp
}
});
yield _this13.sendMessage({
type: "step_stop",
data: {
status: status,
stop: timestamp,
statusDetails: error ? _objectSpread({}, getMessageAndTraceFromError(error)) : undefined
}
});
})();
}
step(name, body) {
var _this14 = this;
return _asyncToGenerator(function* () {
yield _this14.sendMessage({
type: "step_start",
data: {
name,
start: Date.now()

@@ -188,3 +212,3 @@ }

var result = yield body();
yield _this13.sendMessage({
yield _this14.sendMessage({
type: "step_stop",

@@ -202,3 +226,3 @@ data: {

} = err;
yield _this13.sendMessage({
yield _this14.sendMessage({
type: "step_stop",

@@ -219,5 +243,5 @@ data: {

stepDisplayName(name) {
var _this14 = this;
var _this15 = this;
return _asyncToGenerator(function* () {
yield _this14.sendMessage({
yield _this15.sendMessage({
type: "step_metadata",

@@ -231,5 +255,5 @@ data: {

stepParameter(name, value, mode) {
var _this15 = this;
var _this16 = this;
return _asyncToGenerator(function* () {
yield _this15.sendMessage({
yield _this16.sendMessage({
type: "step_metadata",

@@ -236,0 +260,0 @@ data: {

@@ -58,16 +58,16 @@ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }

}
step(name, body) {
logStep() {
var _this10 = this;
return _asyncToGenerator(function* () {
yield _this10.warning();
return body();
})();
}
stepDisplayName() {
step(name, body) {
var _this11 = this;
return _asyncToGenerator(function* () {
yield _this11.warning();
return body();
})();
}
stepParameter() {
stepDisplayName() {
var _this12 = this;

@@ -78,3 +78,3 @@ return _asyncToGenerator(function* () {

}
testCaseId() {
stepParameter() {
var _this13 = this;

@@ -85,2 +85,8 @@ return _asyncToGenerator(function* () {

}
testCaseId() {
var _this14 = this;
return _asyncToGenerator(function* () {
yield _this14.warning();
})();
}

@@ -87,0 +93,0 @@ // eslint-disable-next-line @typescript-eslint/require-await

/// <reference types="node" />
import type { ContentType } from "./model.js";
import type { Status } from "./model.js";
import { type ContentType } from "./model.js";
import { type AttachmentOptions, type Label, type Link, type ParameterMode, type ParameterOptions } from "./model.js";

@@ -21,2 +22,3 @@ import { LabelName, LinkType } from "./model.js";

};
export declare const logStep: (name: string, status?: Status, error?: Error) => PromiseLike<void>;
export declare const step: <T = void>(name: string, body: (context: StepContext) => T | PromiseLike<T>) => PromiseLike<T>;

@@ -23,0 +25,0 @@ export declare const issue: (url: string, name?: string) => PromiseLike<void>;

@@ -1,4 +0,4 @@

export { allureId, attachment, attachmentPath, description, descriptionHtml, displayName, epic, feature, historyId, issue, label, labels, layer, link, links, owner, parameter, parentSuite, severity, step, story, subSuite, suite, tag, tags, testCaseId, tms, } from "./facade.js";
export { allureId, attachment, attachmentPath, description, descriptionHtml, displayName, epic, feature, historyId, issue, label, labels, layer, link, links, logStep, owner, parameter, parentSuite, severity, step, story, subSuite, suite, tag, tags, testCaseId, tms, } from "./facade.js";
export type { StepContext } from "./facade.js";
export type { Attachment, AttachmentOptions, FixtureResult, ImageDiffAttachment, Label, Link, Parameter, ParameterMode, ParameterOptions, StatusDetails, StepResult, TestOrStepResult, TestResult, TestResultContainer, } from "./model.js";
export { ContentType, LinkType, LabelName, Severity, Stage, Status, StatusByPriority } from "./model.js";

@@ -20,6 +20,12 @@ /// <reference types="node" />

updateFixture: (uuid: string, updateFunc: (result: FixtureResult) => void) => void;
stopFixture: (uuid: string, stop?: number) => void;
stopFixture: (uuid: string, opts?: {
stop?: number;
duration?: number;
}) => void;
startTest: (result: Partial<TestResult>, scopeUuids?: string[]) => string;
updateTest: (uuid: string, updateFunc: (result: TestResult) => void) => void;
stopTest: (uuid: string, stop?: number) => void;
stopTest: (uuid: string, opts?: {
stop?: number;
duration?: number;
}) => void;
writeTest: (uuid: string) => void;

@@ -29,3 +35,6 @@ currentStep: (rootUuid: string) => string | undefined;

updateStep: (uuid: string, updateFunc: (stepResult: StepResult) => void) => void;
stopStep: (uuid: string, stop?: number) => void;
stopStep: (uuid: string, opts?: {
stop?: number;
duration?: number;
}) => void;
writeAttachment: (rootUuid: string, parentStepUuid: string | null | undefined, attachmentName: string, attachmentContentOrPath: Buffer | string, options: AttachmentOptions & {

@@ -32,0 +41,0 @@ wrapInStep?: boolean;

/// <reference types="node" />
import type { AttachmentOptions, Label, LabelName, Link, LinkType, ParameterMode, ParameterOptions } from "../../model.js";
import { type AttachmentOptions, type Label, type LabelName, type Link, type LinkType, type ParameterMode, type ParameterOptions, Status } from "../../model.js";
import type { RuntimeMessage } from "../types.js";

@@ -18,2 +18,3 @@ import type { TestRuntime } from "./types.js";

attachmentFromPath(name: string, path: string, options: AttachmentOptions): Promise<void>;
logStep(name: string, status?: Status, error?: Error): Promise<void>;
step<T = void>(name: string, body: () => T | PromiseLike<T>): Promise<T>;

@@ -20,0 +21,0 @@ stepDisplayName(name: string): Promise<void>;

@@ -12,2 +12,3 @@ import type { TestRuntime } from "./types.js";

parameter(): Promise<void>;
logStep(): Promise<void>;
step<T>(name: string, body: () => T | PromiseLike<T>): Promise<T>;

@@ -14,0 +15,0 @@ stepDisplayName(): Promise<void>;

/// <reference types="node" />
import type { AttachmentOptions, Label, Link, ParameterMode, ParameterOptions } from "../../model.js";
import type { AttachmentOptions, Label, Link, ParameterMode, ParameterOptions, Status } from "../../model.js";
export interface TestRuntime {

@@ -14,2 +14,3 @@ labels: (...labels: Label[]) => PromiseLike<void>;

attachmentFromPath: (name: string, path: string, options: Omit<AttachmentOptions, "encoding">) => PromiseLike<void>;
logStep: (name: string, status?: Status, error?: Error) => PromiseLike<void>;
step: <T = void>(name: string, body: () => T | PromiseLike<T>) => PromiseLike<T>;

@@ -16,0 +17,0 @@ stepDisplayName: (name: string) => PromiseLike<void>;

{
"name": "allure-js-commons",
"version": "3.0.0-beta.5",
"version": "3.0.0-beta.6",
"description": "Allure JS Commons",

@@ -75,3 +75,2 @@ "homepage": "https://allurereport.org/",

"@types/node": "^20.14.2",
"@types/source-map-support": "^0.5.7",
"@typescript-eslint/eslint-plugin": "^7.0.0",

@@ -86,11 +85,15 @@ "@typescript-eslint/parser": "^7.0.0",

"eslint-plugin-prefer-arrow": "^1.2.3",
"expect": "^29.7.0",
"npm-run-all2": "^6.1.2",
"rimraf": "^5.0.1",
"source-map-support": "^0.5.21",
"ts-node": "^10.9.2",
"tslib": "^2.6.2",
"typescript": "^5.2.2",
"vitest": "^1.6.0"
},
"peerDependencies": {
"allure-playwright": "3.0.0-beta.6"
},
"peerDependenciesMeta": {
"allure-playwright": {
"optional": true
}
}
}

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

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

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