Last active
January 8, 2016 20:12
-
-
Save jbpros/b677e929d219bc8a213b to your computer and use it in GitHub Desktop.
A listener to log information about tags
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// features/step_definitions/tag_logger.js | |
function TagLogger() { | |
var tags = {}; | |
this.hear = function (event, callback) { | |
var eventName = event.getName(); | |
switch (eventName) { | |
case 'BeforeScenario': | |
var scenario = event.getPayloadItem('scenario'); | |
scenario.getTags().forEach(function (tag) { | |
var tagName = tag.getName(); | |
tags[tagName] = (tags[tagName] || 0) + 1; | |
}); | |
break | |
case 'AfterFeatures': | |
console.log("All tags:", tags); | |
} | |
callback(); | |
}; | |
} | |
module.exports = function () { | |
this.registerListener(new TagLogger()) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment