
Security News
Bun 1.2.19 Adds Isolated Installs for Better Monorepo Support
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
allure-client
Advanced tools
Wrapper for [allure-server](https://github.com/KnowledgeExpert/allure-server) http client for NodeJS in Typescript. Can be used for working with allure-server and generating allure XML from allure-server JSON data.
Wrapper for allure-server http client for NodeJS in Typescript. Can be used for working with allure-server and generating allure XML from allure-server JSON data.
Repository contains Runtime module which handles http layer, and Session module which wraps Runtime
and provides concise API for tests.
For Jasmine you can simple inject allure-client as custom reporter:
base-spec.ts
const Configuration = require("allure-client").Configuration;
// setup some configurations
Configuration.baseUrl = "http://localhost:3000";
Configuration.baseDir = "build/allure-results";
// create Session object (it will automatically generate unic UUID for further operations)
const session = await Session.create();
jasmine.getEnv().addReporter({
suiteStarted: async function (suite) {
await session.startSuite(suite.fullName);
},
specStarted: async function (spec) {
await session.startTest(spec.description)
},
specDone: async function (spec) {
const status = getTestcaseStatus(spec.status);
if (status !== 'passed') {
await session.endTest(status);
} else {
await session.endTest(status, getTestcaseError(spec));
}
},
suiteDone: async function (result) {
await session.endSuite();
},
jasmineDone: async function () {
// after all tests done, you should call writeToXML() method
// it will automatically pull collected data in JSON format
// and write it in local directory as XML structure
// which can be handled be allure-cli
await session.writeToXML();
}
});
// util functions
function getTestcaseStatus(status): 'skipped' | 'passed' | 'failed' {
if (status === 'disabled' || status === 'pending') {
return 'skipped';
} else if (status === 'passed') {
return 'passed';
} else {
return 'failed';
}
}
function getTestcaseError(result) {
if (result.status === 'disabled') {
return {
message: 'This test was ignored',
stack: ''
};
} else if (result.status === 'pending') {
return {
message: result.pendingReason,
stack: ''
};
}
return result.failedExpectations
? result.failedExpectations[0]
: {
message: 'No failure expectations found.',
stack: ''
};
}
Configuration for module consists of:
Configuration.baseUrl
- allure-server uriConfiguration.baseAuth
- allure-server basic auth (optional)Configuration.baseDir
- directory where allure-client will store XML and attachments for Allure-Cli (default - ./allure-results
)Note: Configuration.baseUrl
should be initialized before calling any Session
or Runtime
methods;
Session
Session
, should be called to get Session
object.const session = await Session.create();
name: string
- suite nametimestamp: number
- operation time
Date.now()
await session.startSuite('My Suite Name');
timestamp: number
- operation time
Date.now()
await session.endSuite();
name: string
- test case nametimestamp: number
- operation time
Date.now()
await session.startTest('My Test Name');
status: string
- test case status
broken
failed
passed
skipped
error: Error
- error object (optional)timestamp: number
- operation time
Date.now()
const error = new Error('Something went wrong');
await session.endTest('failed', error);
name: string
- test step name
* timestamp: number
- operation time
* default value - Date.now()
await session.startStep('My Test Name');
status: string
- test step status
* possible options:
* failed
* passed
* timestamp: number
- operation time
* default value - Date.now()
await session.endStep('passed');
name: string
- test label namevalue: string
- test label contentawait session.writeToXML();
type: string
- description type
* possible options:
* text
* html
* markdown
* content: string
- description content
await session.setDescription('text', 'some custom test description');
title: string
- attachment title
* content : ReadStream | Object
- attachment data
* ReadStream
- just pass attachment as ReadStream
* Object: { mime: string, buffer: Buffer }
- if you had a buffer, you should pass it with specifying mime-type for file
const readStream = fs.createReadStream('file1.txt');
const buff = fs.readFileSync('fil2.txt');
await session.addAttachment('file 1', readStream);
await session.addAttachment('file 2', {mime: 'text/plain', buffer: buff});
severity: string
- test severity
* possible options:
* blocker
* critical
* normal
* minor
* trivial
await session.setSeverity('critical');
epic: string
- test Epic
await session.addEpic('Super Epic');
story: string
- test Story
await session.addEpic('Super Story');
feature: string
- test Feature
await session.addFeature('Super Feature');
name: string
- Environment name
* value: string
- Environment value
await session.addEnvironment('Chrome', '56');
name: string
- test label name
* value: string
- test label content
await session.addLabel('some label name', 'mapped value');
name: string
- test label name
* value: string
- test label content
await session.addLabel('some label name', 'mapped value');
FAQs
Wrapper for [allure-server](https://github.com/KnowledgeExpert/allure-server) http client for NodeJS in Typescript. Can be used for working with allure-server and generating allure XML from allure-server JSON data.
The npm package allure-client receives a total of 0 weekly downloads. As such, allure-client popularity was classified as not popular.
We found that allure-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
Security News
Popular npm packages like eslint-config-prettier were compromised after a phishing attack stole a maintainer’s token, spreading malicious updates.
Security News
/Research
A phishing attack targeted developers using a typosquatted npm domain (npnjs.com) to steal credentials via fake login pages - watch out for similar scams.