Skip to content

Commit

Permalink
Merge pull request #4 from Dignifiedquire/update
Browse files Browse the repository at this point in the history
Update to Grunt 0.4.0 and Cucumber 0.3.0
  • Loading branch information
s9tpepper committed Apr 1, 2013
2 parents d076c93 + 39bcf1f commit 7e5303a
Show file tree
Hide file tree
Showing 9 changed files with 252 additions and 163 deletions.
14 changes: 14 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"curly": true,
"eqeqeq": true,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
"sub": true,
"undef": true,
"boss": true,
"eqnull": true,
"node": true,
"es5": true
}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog


## v 0.2.0

* Update to Grunt `0.4.0`.
* Update to CucumberJS `0.3.0`.
25 changes: 25 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = function (grunt) {
'use strict';

grunt.initConfig({
jshint: {
files: ['grunt.js', 'tasks/*.js'],
options: {
jshintrc: '.jshintrc'
}
},
cucumberjs: {
files: 'features',
options: {
steps: 'features/step_definitions',
format: 'pretty'
}
}
});

grunt.loadNpmTasks('grunt-contrib-jshint');

grunt.loadTasks('tasks');

grunt.registerTask('default', ['jshint', 'cucumberjs']);
};
93 changes: 78 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,88 @@
# grunt-cucumber-js
# grunt-cuccumber-js

> Run all you your cucumber features through Grunt.
**Warning:** This task requires a Grunt version of at least `0.4.0`.

A grunt.js task to run your cucumber.js feature suite.

## Getting Started
Install this grunt plugin next to your project's grunt.js gruntfile with: `npm install grunt-cucumber`
If you haven't used [Grunt](http://gruntjs.com/) before, be sure to
check out the [Getting Started](http://gruntjs.com/getting-started)
guide, as it explains how to create a
[Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install
and use Grunt plugins. Once you're familiar with that process, you may
install this plugin with this command:

```shell
$ npm install grunt-cucumber --save-dev
```
Then add this configuration to your project's `Gruntfile.js`.

```js
grunt.loadNpmTasks('grunt-cucumber');
```

## Cucumberjs Task
_Run this task with the `grunt cucumberjs` command._

### Options

#### steps
Type: `String`

Default: `''`

Require files before executing the features. If this option is not
specified, all *.js and *.coffee files that are siblings or below the
features will be loaded automatically. Automatic loading is disabled
when this option is specified, and all loading becomes explicit.

Then add this line to your project's `grunt.js` gruntfile:
Files under directories named "support" are always loaded first.

```javascript
#### tags
Type: `String`

Default: `''`

Only execute the features or scenarios with tags
matching TAG_EXPRESSION. Scenarios inherit tags
declared on the Feature level. The simplest
TAG_EXPRESSION is simply a tag. Example:
`tags: '@dev'`

When a tag in a tag expression starts with a ~,
this represents boolean NOT. Example:
`tags: '~@dev'`

A tag expression can have several tags separated
by a comma, which represents logical OR. Example:
`tags: '@dev,@wip'`

#### format
Type: `String`
Default: `''`

How to format features (default: progress).
Available formats:
* pretty : prints the feature as is
* progress: prints one character per scenario
* json : prints the feature as JSON
* summary : prints a summary only, after all scenarios were executed

### Usage Examples


#### Basic Use
```js
// Project configuration.
grunt.initConfig({
cucumberjs: {
executable: "../path/to/custom/cucumberjs",
features: "path/to/features",
steps: "path/to/step_definitions",
tags: "@dev"
files: 'path/to/features',
options: {
steps: "path/to/step_definitions"
}
}
});

grunt.loadNpmTasks('grunt-cucumber');

grunt.registerTask('default', 'cucumberjs');
```

## Bugs
Expand All @@ -28,8 +91,8 @@ Help us squash them by submitting an issue that describes how you encountered it

## Release History

see [CHANGELOG](/s9tpepper/grunt-cucumber-js/blob/master/CHANGELOG).
see [CHANGELOG](CHANGELOG.md).

## License
Copyright (c) 2012 "s9tpepper" Omar Gonzalez & contributors.
Licensed under the MIT license.
Licensed under the MIT license.
2 changes: 0 additions & 2 deletions bin/grunt-cucumber

This file was deleted.

38 changes: 19 additions & 19 deletions features/step_definitions/Testing_steps.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
function Testing_steps() {
var firstNumber;
var secondNumber;
var sum = 0;
var firstNumber;
var secondNumber;
var sum = 0;

this.Given(/^I have the number (\d+) and (\d+)$/, function(arg1, arg2, callback) {
firstNumber = parseInt(arg1);
secondNumber = parseInt(arg2);
callback();
});
this.Given(/^I have the number (\d+) and (\d+)$/, function(arg1, arg2, callback) {
firstNumber = parseInt(arg1);
secondNumber = parseInt(arg2);
callback();
});

this.When(/^I add them together$/, function(callback) {
sum = firstNumber + secondNumber;
callback();
});
this.When(/^I add them together$/, function(callback) {
sum = firstNumber + secondNumber;
callback();
});

this.Then(/^I should have (\d+)$/, function(arg1, callback) {
var expectedSum = parseInt(arg1);
if (expectedSum !== sum) {
throw new Error("It doesn't add up! " + arg1 + " !== " + sum);
}
callback();
});
this.Then(/^I should have (\d+)$/, function(arg1, callback) {
var expectedSum = parseInt(arg1);
if (expectedSum !== sum) {
throw new Error('It doesn\'t add up! ' + arg1 + ' !== ' + sum);
}
callback();
});

};

Expand Down
36 changes: 0 additions & 36 deletions grunt.js

This file was deleted.

85 changes: 42 additions & 43 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,43 @@
{
"name" : "grunt-cucumber",
"description" : "Grunt task for running Cucumber.js",
"version" : "0.1.1",
"homepage" : "https://github.com/s9tpepper/grunt-cucumber-js",
"author" : {
"name" : "Omar Gonzalez",
"email" : "[email protected]",
"url" : "http://omar.likesflex.com"
},
"repository" : {
"type" : "git",
"url" : "git://github.com/s9tpepper/grunt-cucumber-js.git"
},
"bugs" : {
"url" : "https://github.com/s9tpepper/grunt-cucumber-js/issues"
},
"licenses" : [
{
"type" : "MIT",
"url" : "https://github.com/s9tpepper/grunt-cucumber-js/blob/master/LICENSE-MIT"
}
],
"main" : "grunt.js",
"bin" : "bin/grunt-cucumber",
"engines" : {
"node" : "*"
},
"scripts" : {
},
"dependencies" : {
},
"devDependencies" : {
"grunt" : "~0.3.9",
"cucumber": "~0.2.19"
},
"keywords" : [
"gruntplugin",
"grunt",
"plugins",
"builds",
"ci"
]
}
"name": "grunt-cucumber",
"description": "Grunt task for running Cucumber.js",
"version": "0.2.0",
"homepage": "https://github.com/s9tpepper/grunt-cucumber-js",
"author": {
"name": "Omar Gonzalez",
"email": "[email protected]",
"url": "http://omar.likesflex.com"
},
"repository": {
"type": "git",
"url": "git://github.com/s9tpepper/grunt-cucumber-js.git"
},
"bugs": {
"url": "https://github.com/s9tpepper/grunt-cucumber-js/issues"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/s9tpepper/grunt-cucumber-js/blob/master/LICENSE-MIT"
}
],
"main": "Gruntfile.js",
"engines": {
"node": "*"
},
"scripts": {},
"dependencies": {
"cucumber": "~0.3.0"
},
"devDependencies": {
"grunt": "~0.4.0",
"grunt-contrib-jshint": "~0.2.0"
},
"keywords": [
"gruntplugin",
"grunt",
"plugins",
"builds",
"ci"
]
}
Loading

0 comments on commit 7e5303a

Please sign in to comment.