allure-js-commons
Advanced tools
Comparing version 1.2.0 to 1.2.1
'use strict'; | ||
var Description = require('./description'); | ||
var STATUSES = ['passed', 'pending', 'skipped', 'failed', 'broken']; | ||
@@ -12,4 +15,4 @@ function Test(name, timestamp) { | ||
Test.prototype.setDescription = function (description) { | ||
this.description = description; | ||
Test.prototype.setDescription = function (description, type) { | ||
this.description = new Description(description, type); | ||
}; | ||
@@ -55,3 +58,2 @@ | ||
title: this.name, | ||
description: this.description, | ||
labels: { | ||
@@ -78,5 +80,11 @@ label: this.labels.map(function (label) { | ||
}; | ||
if (this.failure) { | ||
result.failure = this.failure; | ||
} | ||
if (this.description) { | ||
result.description = this.description.toXML(); | ||
} | ||
return result; | ||
@@ -83,0 +91,0 @@ }; |
@@ -71,4 +71,4 @@ 'use strict'; | ||
Allure.prototype.setDescription = function(description) { | ||
this.getCurrentTest().setDescription(description); | ||
Allure.prototype.setDescription = function(description, type) { | ||
this.getCurrentTest().setDescription(description, type); | ||
}; | ||
@@ -75,0 +75,0 @@ |
{ | ||
"name": "allure-js-commons", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Common helper for writing plugins to allure-framework", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -64,4 +64,4 @@ 'use strict'; | ||
Allure.prototype.description = function(description) { | ||
this._allure.setDescription(description); | ||
Allure.prototype.description = function(description, type) { | ||
this._allure.setDescription(description, type); | ||
}; | ||
@@ -68,0 +68,0 @@ |
@@ -49,2 +49,23 @@ var proxyquire = require('proxyquire'); | ||
}); | ||
it('should add text type description by default', function() { | ||
var testCase = allure.getCurrentSuite().testcases[0]; | ||
var description = 'test desc'; | ||
allure.setDescription(description); | ||
expect(testCase.description.value).toBe(description); | ||
expect(testCase.description.type).toBe('text'); | ||
}); | ||
it('should add description with markdown', function() { | ||
var testCase = allure.getCurrentSuite().testcases[0]; | ||
var description = 'test desc'; | ||
var type = 'markdown'; | ||
allure.setDescription(description, type); | ||
expect(testCase.description.value).toBe(description); | ||
expect(testCase.description.type).toBe(type); | ||
}); | ||
}); |
@@ -17,8 +17,7 @@ 'use strict'; | ||
it('should add labels and description', function() { | ||
runtime.description('test desc'); | ||
it('should add labels', function() { | ||
runtime.feature('labels'); | ||
runtime.story('add'); | ||
expect(allure.getCurrentSuite().currentTest).toEqual(joc({ | ||
description: 'test desc', | ||
labels: [ | ||
@@ -31,2 +30,25 @@ {name: 'feature', value: 'labels'}, | ||
it('should add text type description by default', function() { | ||
var description = 'test desc'; | ||
runtime.description(description); | ||
expect(allure.getCurrentSuite().currentTest.description).toEqual(joc({ | ||
type: 'text', | ||
value: description | ||
})); | ||
}); | ||
it('should add description with markdown', function() { | ||
var description = 'test desc'; | ||
var type = 'markdown'; | ||
runtime.description(description, type); | ||
expect(allure.getCurrentSuite().currentTest.description).toEqual(joc({ | ||
type: type, | ||
value: description | ||
})); | ||
}); | ||
it('should add parameters', function() { | ||
@@ -33,0 +55,0 @@ runtime.addArgument('test', 'value'); |
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
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
21855
20
606