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

allure-jasmine

Package Overview
Dependencies
Maintainers
0
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

allure-jasmine - npm Package Compare versions

Comparing version 3.0.0-beta.3 to 3.0.0-beta.4

139

dist/cjs/index.js

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

var _utils = require("./utils.js");
var _excluded = ["testMode", "resultsDir"];
var _excluded = ["resultsDir"];
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }

@@ -40,2 +40,5 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }

}
var {
ALLURE_TEST_MODE
} = _nodeProcess.env;
class AllureJasmineReporter {

@@ -46,5 +49,5 @@ constructor(config) {

_defineProperty(this, "jasmineSuitesStack", []);
_defineProperty(this, "scopesStack", []);
var _ref = config || {},
{
testMode,
resultsDir = "./allure-results"

@@ -54,3 +57,3 @@ } = _ref,

this.allureRuntime = new _reporter.ReporterRuntime(_objectSpread(_objectSpread({}, restConfig), {}, {
writer: testMode ? new _reporter.MessageWriter() : new _reporter.FileSystemWriter({
writer: ALLURE_TEST_MODE ? new _reporter.MessageWriter() : new _reporter.FileSystemWriter({
resultsDir

@@ -64,3 +67,4 @@ })

// the best place to start global container for hooks and nested suites
this.allureRuntime.startScope();
var scopeUuid = this.allureRuntime.startScope();
this.scopesStack.push(scopeUuid);
}

@@ -84,5 +88,6 @@ getCurrentSpecPath() {

handleAllureRuntimeMessages(message) {
this.allureRuntime.applyRuntimeMessages([message], {
testUuid: this.currentAllureTestUuid
});
if (!this.currentAllureTestUuid) {
return;
}
this.allureRuntime.applyRuntimeMessages(this.currentAllureTestUuid, [message]);
}

@@ -92,4 +97,3 @@ jasmineStarted() {

var globalJasmine = globalThis.jasmine;
var currentAllureResultUuidGetter = () => this.currentAllureTestUuid;
var currentAllureStepResultGetter = () => this.allureRuntime.getCurrentStep(currentAllureResultUuidGetter());
var currentAllureStepResultGetter = () => this.currentAllureTestUuid ? this.allureRuntime.currentStep(this.currentAllureTestUuid) : undefined;
// @ts-ignore

@@ -102,7 +106,8 @@ var originalExpectationHandler = globalJasmine.Spec.prototype.addExpectationResult;

var isStepFailed = !passed && !isError;
if (currentAllureStepResultGetter() && isStepFailed) {
allureRuntime.updateStep(result => {
var stepUuid = currentAllureStepResultGetter();
if (stepUuid && isStepFailed) {
allureRuntime.updateStep(stepUuid, result => {
result.status = _allureJsCommons.Status.FAILED;
result.stage = _allureJsCommons.Stage.FINISHED;
}, currentAllureResultUuidGetter());
});
}

@@ -114,7 +119,11 @@ originalExpectationHandler.call(this, passed, data, isError);

this.jasmineSuitesStack.push(suite);
this.allureRuntime.startScope();
var scopeUuid = this.allureRuntime.startScope();
this.scopesStack.push(scopeUuid);
}
suiteDone() {
this.jasmineSuitesStack.pop();
this.allureRuntime.writeScope();
var scopeUuid = this.scopesStack.pop();
if (scopeUuid) {
this.allureRuntime.writeScope(scopeUuid);
}
}

@@ -126,8 +135,11 @@ specStarted(spec) {

stage: _allureJsCommons.Stage.RUNNING
});
}, this.scopesStack);
}
specDone(spec) {
if (!this.currentAllureTestUuid) {
return;
}
var specPath = this.getCurrentSpecPath();
var exceptionInfo = (0, _utils.findMessageAboutThrow)(spec.failedExpectations) || (0, _utils.findAnyError)(spec.failedExpectations);
this.allureRuntime.updateTest(result => {
this.allureRuntime.updateTest(this.currentAllureTestUuid, result => {
var suitesLabels = (0, _reporter.getSuiteLabels)(specPath);

@@ -161,6 +173,4 @@ result.labels.push(...suitesLabels);

}
}, this.currentAllureTestUuid);
this.allureRuntime.stopTest({
uuid: this.currentAllureTestUuid
});
this.allureRuntime.stopTest(this.currentAllureTestUuid);
this.allureRuntime.writeTest(this.currentAllureTestUuid);

@@ -172,4 +182,7 @@ this.currentAllureTestUuid = undefined;

this.allureRuntime.writeCategoriesDefinitions();
// write global container
this.allureRuntime.writeScope();
// write global container (or any remaining scopes)
this.scopesStack.forEach(scopeUuid => {
this.allureRuntime.writeScope(scopeUuid);
});
this.scopesStack = [];
}

@@ -200,18 +213,28 @@ installHooks() {

done();
this.allureRuntime.startFixture(fixtureType, {
name: fixtureName,
stage: _allureJsCommons.Stage.FINISHED,
status: _allureJsCommons.Status.PASSED,
start
});
this.allureRuntime.stopFixture();
var scopeUuid = this.scopesStack.length > 0 ? this.scopesStack[this.scopesStack.length - 1] : undefined;
if (scopeUuid) {
var fixtureUuid = this.allureRuntime.startFixture(scopeUuid, fixtureType, {
name: fixtureName,
stage: _allureJsCommons.Stage.FINISHED,
status: _allureJsCommons.Status.PASSED,
start
});
if (fixtureUuid) {
this.allureRuntime.stopFixture(fixtureUuid);
}
}
}).catch(err => {
done.fail(err);
this.allureRuntime.startFixture(fixtureType, {
name: fixtureName,
stage: _allureJsCommons.Stage.FINISHED,
status: _allureJsCommons.Status.BROKEN,
start
});
this.allureRuntime.stopFixture();
var scopeUuid = this.scopesStack.length > 0 ? this.scopesStack[this.scopesStack.length - 1] : undefined;
if (scopeUuid) {
var fixtureUuid = this.allureRuntime.startFixture(scopeUuid, fixtureType, {
name: fixtureName,
stage: _allureJsCommons.Stage.FINISHED,
status: _allureJsCommons.Status.BROKEN,
start
});
if (fixtureUuid) {
this.allureRuntime.stopFixture(fixtureUuid);
}
}
});

@@ -221,9 +244,14 @@ } else {

done();
this.allureRuntime.startFixture(fixtureType, {
name: fixtureName,
stage: _allureJsCommons.Stage.FINISHED,
status: _allureJsCommons.Status.PASSED,
start
});
this.allureRuntime.stopFixture();
var scopeUuid = this.scopesStack.length > 0 ? this.scopesStack[this.scopesStack.length - 1] : undefined;
if (scopeUuid) {
var fixtureUuid = this.allureRuntime.startFixture(scopeUuid, fixtureType, {
name: fixtureName,
stage: _allureJsCommons.Stage.FINISHED,
status: _allureJsCommons.Status.PASSED,
start
});
if (fixtureUuid) {
this.allureRuntime.stopFixture(fixtureUuid);
}
}
} catch (err) {

@@ -234,13 +262,18 @@ var {

} = err;
this.allureRuntime.startFixture(fixtureType, {
name: fixtureName,
stage: _allureJsCommons.Stage.FINISHED,
status: _allureJsCommons.Status.BROKEN,
statusDetails: {
message,
trace: stack
},
start
});
this.allureRuntime.stopFixture();
var _scopeUuid = this.scopesStack.length > 0 ? this.scopesStack[this.scopesStack.length - 1] : undefined;
if (_scopeUuid) {
var _fixtureUuid = this.allureRuntime.startFixture(_scopeUuid, fixtureType, {
name: fixtureName,
stage: _allureJsCommons.Stage.FINISHED,
status: _allureJsCommons.Status.BROKEN,
statusDetails: {
message,
trace: stack
},
start
});
if (_fixtureUuid) {
this.allureRuntime.stopFixture(_fixtureUuid);
}
}
throw err;

@@ -247,0 +280,0 @@ }

@@ -1,2 +0,2 @@

var _excluded = ["testMode", "resultsDir"];
var _excluded = ["resultsDir"];
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; }

@@ -11,3 +11,3 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }

function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
import { cwd } from "node:process";
import { cwd, env } from "node:process";
import * as allure from "allure-js-commons";

@@ -32,2 +32,5 @@ import { Stage, Status } from "allure-js-commons";

}
var {
ALLURE_TEST_MODE
} = env;
export default class AllureJasmineReporter {

@@ -38,5 +41,5 @@ constructor(config) {

_defineProperty(this, "jasmineSuitesStack", []);
_defineProperty(this, "scopesStack", []);
var _ref = config || {},
{
testMode,
resultsDir = "./allure-results"

@@ -46,3 +49,3 @@ } = _ref,

this.allureRuntime = new ReporterRuntime(_objectSpread(_objectSpread({}, restConfig), {}, {
writer: testMode ? new MessageWriter() : new FileSystemWriter({
writer: ALLURE_TEST_MODE ? new MessageWriter() : new FileSystemWriter({
resultsDir

@@ -56,3 +59,4 @@ })

// the best place to start global container for hooks and nested suites
this.allureRuntime.startScope();
var scopeUuid = this.allureRuntime.startScope();
this.scopesStack.push(scopeUuid);
}

@@ -76,5 +80,6 @@ getCurrentSpecPath() {

handleAllureRuntimeMessages(message) {
this.allureRuntime.applyRuntimeMessages([message], {
testUuid: this.currentAllureTestUuid
});
if (!this.currentAllureTestUuid) {
return;
}
this.allureRuntime.applyRuntimeMessages(this.currentAllureTestUuid, [message]);
}

@@ -84,4 +89,3 @@ jasmineStarted() {

var globalJasmine = globalThis.jasmine;
var currentAllureResultUuidGetter = () => this.currentAllureTestUuid;
var currentAllureStepResultGetter = () => this.allureRuntime.getCurrentStep(currentAllureResultUuidGetter());
var currentAllureStepResultGetter = () => this.currentAllureTestUuid ? this.allureRuntime.currentStep(this.currentAllureTestUuid) : undefined;
// @ts-ignore

@@ -94,7 +98,8 @@ var originalExpectationHandler = globalJasmine.Spec.prototype.addExpectationResult;

var isStepFailed = !passed && !isError;
if (currentAllureStepResultGetter() && isStepFailed) {
allureRuntime.updateStep(result => {
var stepUuid = currentAllureStepResultGetter();
if (stepUuid && isStepFailed) {
allureRuntime.updateStep(stepUuid, result => {
result.status = Status.FAILED;
result.stage = Stage.FINISHED;
}, currentAllureResultUuidGetter());
});
}

@@ -106,7 +111,11 @@ originalExpectationHandler.call(this, passed, data, isError);

this.jasmineSuitesStack.push(suite);
this.allureRuntime.startScope();
var scopeUuid = this.allureRuntime.startScope();
this.scopesStack.push(scopeUuid);
}
suiteDone() {
this.jasmineSuitesStack.pop();
this.allureRuntime.writeScope();
var scopeUuid = this.scopesStack.pop();
if (scopeUuid) {
this.allureRuntime.writeScope(scopeUuid);
}
}

@@ -118,8 +127,11 @@ specStarted(spec) {

stage: Stage.RUNNING
});
}, this.scopesStack);
}
specDone(spec) {
if (!this.currentAllureTestUuid) {
return;
}
var specPath = this.getCurrentSpecPath();
var exceptionInfo = findMessageAboutThrow(spec.failedExpectations) || findAnyError(spec.failedExpectations);
this.allureRuntime.updateTest(result => {
this.allureRuntime.updateTest(this.currentAllureTestUuid, result => {
var suitesLabels = getSuiteLabels(specPath);

@@ -153,6 +165,4 @@ result.labels.push(...suitesLabels);

}
}, this.currentAllureTestUuid);
this.allureRuntime.stopTest({
uuid: this.currentAllureTestUuid
});
this.allureRuntime.stopTest(this.currentAllureTestUuid);
this.allureRuntime.writeTest(this.currentAllureTestUuid);

@@ -164,4 +174,7 @@ this.currentAllureTestUuid = undefined;

this.allureRuntime.writeCategoriesDefinitions();
// write global container
this.allureRuntime.writeScope();
// write global container (or any remaining scopes)
this.scopesStack.forEach(scopeUuid => {
this.allureRuntime.writeScope(scopeUuid);
});
this.scopesStack = [];
}

@@ -192,18 +205,28 @@ installHooks() {

done();
this.allureRuntime.startFixture(fixtureType, {
name: fixtureName,
stage: Stage.FINISHED,
status: Status.PASSED,
start
});
this.allureRuntime.stopFixture();
var scopeUuid = this.scopesStack.length > 0 ? this.scopesStack[this.scopesStack.length - 1] : undefined;
if (scopeUuid) {
var fixtureUuid = this.allureRuntime.startFixture(scopeUuid, fixtureType, {
name: fixtureName,
stage: Stage.FINISHED,
status: Status.PASSED,
start
});
if (fixtureUuid) {
this.allureRuntime.stopFixture(fixtureUuid);
}
}
}).catch(err => {
done.fail(err);
this.allureRuntime.startFixture(fixtureType, {
name: fixtureName,
stage: Stage.FINISHED,
status: Status.BROKEN,
start
});
this.allureRuntime.stopFixture();
var scopeUuid = this.scopesStack.length > 0 ? this.scopesStack[this.scopesStack.length - 1] : undefined;
if (scopeUuid) {
var fixtureUuid = this.allureRuntime.startFixture(scopeUuid, fixtureType, {
name: fixtureName,
stage: Stage.FINISHED,
status: Status.BROKEN,
start
});
if (fixtureUuid) {
this.allureRuntime.stopFixture(fixtureUuid);
}
}
});

@@ -213,9 +236,14 @@ } else {

done();
this.allureRuntime.startFixture(fixtureType, {
name: fixtureName,
stage: Stage.FINISHED,
status: Status.PASSED,
start
});
this.allureRuntime.stopFixture();
var scopeUuid = this.scopesStack.length > 0 ? this.scopesStack[this.scopesStack.length - 1] : undefined;
if (scopeUuid) {
var fixtureUuid = this.allureRuntime.startFixture(scopeUuid, fixtureType, {
name: fixtureName,
stage: Stage.FINISHED,
status: Status.PASSED,
start
});
if (fixtureUuid) {
this.allureRuntime.stopFixture(fixtureUuid);
}
}
} catch (err) {

@@ -226,13 +254,18 @@ var {

} = err;
this.allureRuntime.startFixture(fixtureType, {
name: fixtureName,
stage: Stage.FINISHED,
status: Status.BROKEN,
statusDetails: {
message,
trace: stack
},
start
});
this.allureRuntime.stopFixture();
var _scopeUuid = this.scopesStack.length > 0 ? this.scopesStack[this.scopesStack.length - 1] : undefined;
if (_scopeUuid) {
var _fixtureUuid = this.allureRuntime.startFixture(_scopeUuid, fixtureType, {
name: fixtureName,
stage: Stage.FINISHED,
status: Status.BROKEN,
statusDetails: {
message,
trace: stack
},
start
});
if (_fixtureUuid) {
this.allureRuntime.stopFixture(_fixtureUuid);
}
}
throw err;

@@ -239,0 +272,0 @@ }

/// <reference types="jasmine" />
import * as allure from "allure-js-commons";
import type { RuntimeMessage } from "allure-js-commons/sdk";
import type { AllureJasmineConfig } from "./model.js";
import type { Config } from "allure-js-commons/sdk/reporter";
export default class AllureJasmineReporter implements jasmine.CustomReporter {

@@ -9,3 +9,4 @@ private readonly allureRuntime;

private jasmineSuitesStack;
constructor(config: AllureJasmineConfig);
private scopesStack;
constructor(config: Config);
private getCurrentSpecPath;

@@ -12,0 +13,0 @@ private getSpecFullName;

/// <reference types="jasmine" />
import type { Config } from "allure-js-commons/sdk/reporter";
export interface AllureJasmineConfig extends Config {
testMode?: boolean;
}
export type JasmineBeforeAfterFn = (action: (done: DoneFn) => void, timeout?: number) => void;
{
"name": "allure-jasmine",
"version": "3.0.0-beta.3",
"version": "3.0.0-beta.4",
"description": "Allure Jasmine integration",

@@ -30,3 +30,4 @@ "homepage": "https://allurereport.org/",

"scripts": {
"clean": "rimraf ./dist",
"allure-report": "allure serve ./out/allure-results",
"clean": "rimraf ./dist ./out",
"compile": "run-s 'compile:*'",

@@ -37,2 +38,3 @@ "compile:esm-babel": "babel --config-file ./babel.esm.json ./src --out-dir ./dist/esm --extensions '.ts' --source-maps",

"compile:fixup": "node ./scripts/fixup.mjs",
"generate-report": "allure generate ./out/allure-results -o ./out/allure-report --clean",
"lint": "eslint ./src ./test --ext .ts",

@@ -43,3 +45,3 @@ "lint:fix": "eslint ./src ./test --ext .ts --fix",

"dependencies": {
"allure-js-commons": "3.0.0-beta.3"
"allure-js-commons": "3.0.0-beta.4"
},

@@ -58,2 +60,4 @@ "devDependencies": {

"@typescript-eslint/parser": "^7.0.0",
"allure-commandline": "^2.29.0",
"allure-vitest": "3.0.0-beta.4",
"babel-plugin-add-module-exports": "^1.0.4",

@@ -72,4 +76,4 @@ "eslint": "^8.57.0",

"typescript": "^5.2.2",
"vitest": "^1.5.3"
"vitest": "^1.6.0"
}
}

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