Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
allure-decorators
Advanced tools
Write your tests in a Java-like annotation-driven manner via JS decorators.
Testdeck decorators integration for Allure framework
npm i allure-js-commons allure-decorators allure-mocha @testdeck/mocha mocha @types/mocha mocha-multi-reporters source-map-support --save-dev
or via yarn:
yarn add allure-js-commons allure-decorators allure-mocha @testdeck/mocha mocha @types/mocha mocha-multi-reporters source-map-support --dev
Create the following .mocharc.json:
{
"require": "source-map-support/register",
"spec": "./src/tests/**/*.js",
"reporter": "mocha-multi-reporters",
"reporter-option": "configFile=reporterConfig.json"
}
And the reporterConfig.json:
{
"reporterEnabled": "allure-mocha, list",
"allureMochaReporterOptions": {
"resultsDir": "./allure-results"
}
}
Note that there are known issues with Mocha 8+ parallel test execution. So try to avoid using this flag at the moment.
Your tsconfig.json must include the following compiler options:
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true
}
}
Now your test may look like the following:
import { suite, test } from '@testdeck/mocha'
import {
assignPmsUrl,
assignTmsUrl,
data,
decorate,
description,
epic,
feature,
issue,
owner,
severity,
story,
tag,
testCaseId
} from 'allure-decorators'
import { ContentType, Severity } from 'allure-js-commons'
import { allure, MochaAllure } from 'allure-mocha/runtime'
// the other imports
@suite
class AuthorizationTests {
public static testData = (): User[] => {
return [User.dummy(), User.dummy1()]
}
@issue('11')
@testCaseId('10')
@severity(Severity.BLOCKER)
@epic('User Authentication')
@feature('Login')
@story('Authorization')
@owner('skorol')
@tag('smoke')
@description('Basic authorization test.')
@data(AuthorizationTests.testData)
@data.naming(user => `${user} should be able to sign`)
@test
public userShouldBeAbleToSignIn(user: User) {
open(LoginPage)
.loginWith(user)
.select(ProfilePage)
verifyThat(atProfilePage)
.fullNameIs(user.fullName)
.usernameIs(user.username)
}
public before() {
decorate<MochaAllure>(allure)
assignTmsUrl(process.env.TMS_URL)
assignPmsUrl(process.env.PMS_URL)
}
public after() {
allure.attachment('Test attachment', 'test attachment content', ContentType.TEXT)
}
}
You should pay attention to the following line:
decorate<MochaAllure>(allure)
To be able to use decorators, you have to call decorate
function explicitly and set your reporter's instance in before
hook. This was done intentionally to allow clients decide which reporter they want to use with decorators module.
Note that data
is a testdeck specific extension which allows injecting parameters into Allure scope.
At the moment, testdeck supports only Mocha, Jest and Jasmine frameworks.
If you want to add the other integration, feel free to contact Allure team to discuss the potential design options.
allure-decorators
dependency.data
decorator extension for the other frameworks.FAQs
Write your tests in a Java-like annotation-driven manner via JS decorators.
The npm package allure-decorators receives a total of 836 weekly downloads. As such, allure-decorators popularity was classified as not popular.
We found that allure-decorators demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.