gemini-teamcity
Advanced tools
Comparing version 0.9.0 to 1.0.0
var _console = require('console'); | ||
function getTestName(eventData) { | ||
return (eventData.suiteFullName.trim() + '.' + | ||
eventData.stateName.trim() + '.' + | ||
var fullName = eventData.suite.fullName.trim(); | ||
var stateName = eventData.suite.name.trim(); | ||
return (fullName.replace(new RegExp(' ' + stateName + '$'), '.' + stateName) + '.' + | ||
eventData.browserId.replace(/ /g, '')) | ||
@@ -7,0 +9,0 @@ .replace(/ /g, '_'); |
{ | ||
"name": "gemini-teamcity", | ||
"version": "0.9.0", | ||
"version": "1.0.0", | ||
"description": "Plugin for Gemini which enables reporting test results to TeamCity.", | ||
@@ -15,2 +15,3 @@ "main": "lib/plugin.js", | ||
"gemini", | ||
"gemini-plugin", | ||
"teamcity", | ||
@@ -17,0 +18,0 @@ "test", |
@@ -6,4 +6,4 @@ # gemini-express | ||
## Notes | ||
Requires a version of gemini that supports plugin loading. See https://github.com/bem/gemini/pull/127 | ||
## Requirements | ||
Works with [gemini](https://github.com/gemini-testing/gemini) [v0.11](https://github.com/gemini-testing/gemini/releases/tag/v0.11.0) or later. | ||
@@ -10,0 +10,0 @@ ## Installation |
@@ -42,2 +42,3 @@ var sinon = require('sinon'); | ||
var runner; | ||
var eventData; | ||
@@ -55,4 +56,23 @@ function init() { | ||
runner.on = sinon.spy(); | ||
eventData = { | ||
browserId: 'chrome', | ||
suite: { | ||
name: 'state', | ||
fullName: 'suite state' | ||
} | ||
}; | ||
}); | ||
// eventData from lib/runner.js#L105 @ c5224c | ||
// eventData = { | ||
// suite: suite, | ||
// browserId: browser.id, | ||
// | ||
// // Deprecated fileds. TODO: remove before next release | ||
// suiteName: suite.name, | ||
// suitePath: suite.path, | ||
// suiteId: suite.id | ||
//}; | ||
it('should register beginState', function () { | ||
@@ -65,2 +85,3 @@ startRunner(); | ||
describe('on beginState', function () { | ||
beforeEach(function () { | ||
@@ -74,15 +95,4 @@ runner.on = sinon.spy(function (event, cb) { | ||
// eventData from gemini/lib/runner.js L143 | ||
//browserId: session.browser.id, | ||
// suiteName: state.suite.name, | ||
// suiteFullName: state.suite.fullname // added in PR #127 | ||
// suiteId: state.suite.id, | ||
// stateName: state.name | ||
it('should log test started to console', function () { | ||
runner.beginState({ | ||
browserId: 'chrome', | ||
suiteFullName: 'suite', | ||
stateName: 'state' | ||
}); | ||
runner.beginState(eventData); | ||
@@ -93,8 +103,6 @@ expect(_console.log.args[0][0]).to.equal('##teamcity[testStarted name=\'suite.state.chrome\']'); | ||
it('should trim the suite name from spaces', function () { | ||
runner.beginState({ | ||
browserId: 'chrome', | ||
suiteFullName: ' suite ', | ||
stateName: 'state' | ||
}); | ||
eventData.suite.fullName = ' suite state '; | ||
runner.beginState(eventData); | ||
expect(_console.log.args[0][0]).to.contain('\'suite.state.chrome\''); | ||
@@ -104,8 +112,6 @@ }); | ||
it('should trim the state name from spaces', function () { | ||
runner.beginState({ | ||
browserId: 'chrome', | ||
suiteFullName: 'suite', | ||
stateName: ' state ' | ||
}); | ||
eventData.suite.name = ' state '; | ||
runner.beginState(eventData); | ||
expect(_console.log.args[0][0]).to.contain('\'suite.state.chrome\''); | ||
@@ -115,8 +121,6 @@ }); | ||
it('should trim browserId from spaces', function () { | ||
runner.beginState({ | ||
browserId: ' chrome 41 ', | ||
suiteFullName: 'suite', | ||
stateName: 'state' | ||
}); | ||
eventData.browserId = ' chrome 41 '; | ||
runner.beginState(eventData); | ||
expect(_console.log.args[0][0]).to.contain('\'suite.state.chrome41\''); | ||
@@ -126,10 +130,20 @@ }); | ||
it('should replace spaces with underscore', function () { | ||
runner.beginState({ | ||
browserId: 'chrome 41', | ||
suiteFullName: ' root suite ', | ||
stateName: ' state number two' | ||
}); | ||
eventData.browserId = 'chrome 41'; | ||
eventData.suite.fullName = ' root suite state number two '; | ||
eventData.suite.name = ' state number two'; | ||
runner.beginState(eventData); | ||
expect(_console.log.args[0][0]).to.contain('\'root_suite.state_number_two.chrome41\''); | ||
}); | ||
it('should separate state name with a dot', function() { | ||
eventData.suite.fullName = 'foo bar bar'; | ||
eventData.suite.name = 'bar'; | ||
runner.beginState(eventData); | ||
expect(_console.log.args[0][0]).to.contain('\'foo_bar.bar.chrome\''); | ||
}); | ||
}); | ||
@@ -147,7 +161,3 @@ | ||
it('should log test ignored to console', function () { | ||
runner.skipState({ | ||
browserId: 'chrome', | ||
suiteFullName: 'suite', | ||
stateName: 'state' | ||
}); | ||
runner.skipState(eventData); | ||
@@ -158,8 +168,6 @@ expect(_console.log.args[0][0]).to.equal('##teamcity[testIgnored name=\'suite.state.chrome\']'); | ||
it('should trim the suite name from spaces', function () { | ||
runner.skipState({ | ||
browserId: 'chrome', | ||
suiteFullName: ' suite ', | ||
stateName: 'state' | ||
}); | ||
eventData.suite.fullName = ' suite state '; | ||
runner.skipState(eventData); | ||
expect(_console.log.args[0][0]).to.contain('\'suite.state.chrome\''); | ||
@@ -169,8 +177,6 @@ }); | ||
it('should trim the state name from spaces', function () { | ||
runner.skipState({ | ||
browserId: 'chrome', | ||
suiteFullName: 'suite', | ||
stateName: ' state ' | ||
}); | ||
eventData.suite.name = ' state '; | ||
runner.skipState(eventData); | ||
expect(_console.log.args[0][0]).to.contain('\'suite.state.chrome\''); | ||
@@ -180,8 +186,6 @@ }); | ||
it('should trim browserId from spaces', function () { | ||
runner.skipState({ | ||
browserId: ' chrome 41 ', | ||
suiteFullName: 'suite', | ||
stateName: 'state' | ||
}); | ||
eventData.browserId = ' chrome 41 '; | ||
runner.skipState(eventData); | ||
expect(_console.log.args[0][0]).to.contain('\'suite.state.chrome41\''); | ||
@@ -191,10 +195,19 @@ }); | ||
it('should replace spaces with underscore', function () { | ||
runner.skipState({ | ||
browserId: 'chrome 41', | ||
suiteFullName: ' root suite ', | ||
stateName: ' state number two' | ||
}); | ||
eventData.browserId = 'chrome 41'; | ||
eventData.suite.fullName = ' root suite state number two '; | ||
eventData.suite.name = ' state number two'; | ||
runner.skipState(eventData); | ||
expect(_console.log.args[0][0]).to.contain('\'root_suite.state_number_two.chrome41\''); | ||
}); | ||
it('should separate state name with a dot', function() { | ||
eventData.suite.fullName = 'foo bar bar'; | ||
eventData.suite.name = 'bar'; | ||
runner.skipState(eventData); | ||
expect(_console.log.args[0][0]).to.contain('\'foo_bar.bar.chrome\''); | ||
}); | ||
}); | ||
@@ -209,10 +222,9 @@ | ||
startRunner(); | ||
eventData.message = 'error message'; | ||
eventData.stack = 'stack'; | ||
}); | ||
it('should log test finished to console', function () { | ||
runner.error({ | ||
browserId: 'chrome', | ||
suiteFullName: 'suite', | ||
stateName: 'state' | ||
}); | ||
runner.error(eventData); | ||
@@ -223,7 +235,3 @@ expect(_console.log.args[1][0]).to.equal('##teamcity[testFinished name=\'suite.state.chrome\']'); | ||
it('should log test failed to console', function() { | ||
runner.error({ | ||
browserId: 'chrome', | ||
suiteFullName: 'suite', | ||
stateName: 'state' | ||
}); | ||
runner.error(eventData); | ||
@@ -234,8 +242,3 @@ expect(_console.log.args[0][0]).to.contain('##teamcity[testFailed name=\'suite.state.chrome\''); | ||
it('should log the error message', function() { | ||
runner.error({ | ||
browserId: 'chrome', | ||
suiteFullName: 'suite', | ||
stateName: 'state', | ||
message: 'error message' | ||
}); | ||
runner.error(eventData); | ||
@@ -246,11 +249,15 @@ expect(_console.log.args[0][0]).to.contain('message=\'error message\''); | ||
it('should log the stack', function() { | ||
runner.error({ | ||
browserId: 'chrome', | ||
suiteFullName: 'suite', | ||
stateName: 'state', | ||
stack: 'stack' | ||
}); | ||
runner.error(eventData); | ||
expect(_console.log.args[0][0]).to.contain('details=\'stack\''); | ||
}); | ||
it('should separate state name with a dot', function() { | ||
eventData.suite.fullName = 'foo bar bar'; | ||
eventData.suite.name = 'bar'; | ||
runner.error(eventData); | ||
expect(_console.log.args[0][0]).to.contain('\'foo_bar.bar.chrome\''); | ||
}); | ||
}); | ||
@@ -265,11 +272,8 @@ | ||
startRunner(); | ||
eventData.equal = true; | ||
}); | ||
it('should log test finished to console', function () { | ||
runner.endTest({ | ||
browserId: 'chrome', | ||
suiteFullName: 'suite', | ||
stateName: 'state', | ||
equal: true | ||
}); | ||
runner.endTest(eventData); | ||
@@ -280,9 +284,6 @@ expect(_console.log.args[0][0]).to.equal('##teamcity[testFinished name=\'suite.state.chrome\']'); | ||
it('should log test failed to console', function() { | ||
runner.endTest({ | ||
browserId: 'chrome', | ||
suiteFullName: 'suite', | ||
stateName: 'state', | ||
equal: 'foobar' | ||
}); | ||
eventData.equal = 'foobar'; | ||
runner.endTest(eventData); | ||
expect(_console.log.args[0][0]).to.equal('##teamcity[testFailed name=\'suite.state.chrome\']'); | ||
@@ -292,9 +293,6 @@ }); | ||
it('should trim the suite name from spaces', function () { | ||
runner.endTest({ | ||
browserId: 'chrome', | ||
suiteFullName: ' suite ', | ||
stateName: 'state', | ||
equal: true | ||
}); | ||
eventData.suite.fullName = ' suite state '; | ||
runner.endTest(eventData); | ||
expect(_console.log.args[0][0]).to.contain('\'suite.state.chrome\''); | ||
@@ -304,9 +302,6 @@ }); | ||
it('should trim the state name from spaces', function () { | ||
runner.endTest({ | ||
browserId: 'chrome', | ||
suiteFullName: 'suite', | ||
stateName: ' state ', | ||
equal: true | ||
}); | ||
eventData.suite.name = ' state '; | ||
runner.endTest(eventData); | ||
expect(_console.log.args[0][0]).to.contain('\'suite.state.chrome\''); | ||
@@ -316,9 +311,6 @@ }); | ||
it('should trim browserId from spaces', function () { | ||
runner.endTest({ | ||
browserId: ' chrome 41 ', | ||
suiteFullName: 'suite', | ||
stateName: 'state', | ||
equal: true | ||
}); | ||
eventData.browserId = ' chrome 41 '; | ||
runner.endTest(eventData); | ||
expect(_console.log.args[0][0]).to.contain('\'suite.state.chrome41\''); | ||
@@ -328,13 +320,22 @@ }); | ||
it('should replace spaces with underscore', function () { | ||
runner.endTest({ | ||
browserId: 'chrome 41', | ||
suiteFullName: ' root suite ', | ||
stateName: ' state number two', | ||
equal: true | ||
}); | ||
eventData.browserId = 'chrome 41'; | ||
eventData.suite.fullName = ' root suite state number two '; | ||
eventData.suite.name = ' state number two'; | ||
runner.endTest(eventData); | ||
expect(_console.log.args[0][0]).to.contain('\'root_suite.state_number_two.chrome41\''); | ||
}); | ||
it('should separate state name with a dot', function() { | ||
eventData.suite.fullName = 'foo bar bar'; | ||
eventData.suite.name = 'bar'; | ||
runner.endTest(eventData); | ||
expect(_console.log.args[0][0]).to.contain('\'foo_bar.bar.chrome\''); | ||
}); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
104941
1
269