Skip to content
Browse files

Add options parameter to JSON formatter

The JSON formatter now inherits from Cucumber.Listener.Formatter, like
all the formatters.
  • Loading branch information...
1 parent 281248c commit 8db85135a300403b634f07e558c15c030c0dccb1 @isra17 isra17 committed with jbpros Nov 1, 2012
Showing with 10 additions and 3 deletions.
  1. +10 −3 lib/cucumber/listener/json_formatter.js
View
13 lib/cucumber/listener/json_formatter.js
@@ -1,10 +1,17 @@
-var JsonFormatter = function() {
+var JsonFormatter = function(options) {
var Cucumber = require('../../cucumber');
var GherkinJsonFormatter = require('gherkin/lib/gherkin/formatter/json_formatter');
- var gherkinJsonFormatter = new GherkinJsonFormatter(process.stdout);
var currentFeatureId = 'undefined';
- var self = Cucumber.Listener();
+ var self = Cucumber.Listener.Formatter(options);
+
+ var formatterIo = {
+ write: function(string){
+ self.log(string);
+ }
+ };
+ var gherkinJsonFormatter = new GherkinJsonFormatter(formatterIo);
+
var parentFeatureTags;
self.getGherkinFormatter = function() {

0 comments on commit 8db8513

Please sign in to comment.
Something went wrong with that request. Please try again.