Skip to content
This repository was archived by the owner on Jun 11, 2019. It is now read-only.

Commit 1ed925d

Browse files
committed
Add NPM packaging
1 parent f81ad0d commit 1ed925d

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

package.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"author": "Aslak Hellesøy <aslak.hellesoy@gmail.com>",
3+
"contributors": ["Cédric Lamalle <cedric.lamalle@gmail.com>", "Julien Biezemans <jb@jbpros.com>"],
4+
"name": "cucumber-html",
5+
"description": "Cross platform HTML formatter for all implementations of Cucumber",
6+
"version": "0.0.0",
7+
"homepage": "https://github.com/cucumber/cucumber-html",
8+
"repository": {
9+
"type": "git",
10+
"url": "git://github.com/cucumber/cucumber-html.git"
11+
},
12+
"main": "./src/main/resources/cucumber/formatter/formatter",
13+
"engines": {
14+
"node": "*"
15+
},
16+
"dependencies": {},
17+
"devDependencies": {}
18+
}

src/main/resources/cucumber/formatter/formatter.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Cucumber.DOMFormatter = function(rootNode) {
1818
this.uri = function(uri) {
1919
currentUri = uri;
2020
}
21-
21+
2222
this.feature = function(feature) {
2323
prepareAndPrintCurrentNode(feature, {parentNode: rootNode, className: 'feature', heading: '<h1>'});
2424
featureElementsNode = currentNode.find('.childrenElements');
@@ -47,27 +47,27 @@ Cucumber.DOMFormatter = function(rootNode) {
4747
printExamples(step.multiline_arg.value, false);
4848
}
4949
}
50-
50+
5151
this.examples = function(examples) {
5252
prepareAndPrintCurrentNode(examples, {parentNode: featureElementsNode, className: 'exampleBlock', heading: '<h2>'});
5353
printExamples(examples.rows, true);
5454
}
55-
55+
5656
var prepareScenarioElementsNode = function() {
5757
scenarioElementsNode = currentNode.find('.childrenElements');
5858
scenarioElementsNode.addClass('steps');
5959
}
60-
60+
6161
var prepareAndPrintCurrentNode = function(statement, nodeInfo) {
6262
currentNode = $('#templates .blockelement').clone().appendTo(nodeInfo.parentNode);
6363
currentNode.addClass(nodeInfo.className);
6464
printStatement(statement, nodeInfo.heading);
6565
}
66-
66+
6767
var hasExamples = function(step) {
6868
return step.multiline_arg !== undefined && step.multiline_arg.type === 'table';
6969
}
70-
70+
7171
var printExamples = function(examples, hasHeader) {
7272
var table = $('#templates .examples').clone().appendTo(currentNode.find('.childrenElements'));
7373
$.each(examples, function(index, example) {
@@ -79,7 +79,7 @@ Cucumber.DOMFormatter = function(rootNode) {
7979
printExampleRow(node, example);
8080
});
8181
}
82-
82+
8383
var printExampleRow = function(node, example) {
8484
var tr = $('<tr>').appendTo(node);
8585
tr.attr('id', Cucumber.encodeId(currentUri, example.line));
@@ -105,7 +105,7 @@ Cucumber.DOMFormatter = function(rootNode) {
105105
}
106106

107107
Cucumber.Reporter = function() {
108-
var idMatched;
108+
var idMatched;
109109
this.result = function(result) {
110110
$('#'+idMatched).addClass(result.status);
111111
if (result.error_message !== undefined) {
@@ -116,3 +116,7 @@ Cucumber.Reporter = function() {
116116
idMatched = Cucumber.encodeId(match.uri, match.step.line);
117117
}
118118
}
119+
120+
if (typeof module !== 'undefined') {
121+
module.exports = Cucumber;
122+
}

0 commit comments

Comments
 (0)