Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: cucumber/cucumber-js
...
head fork: cucumber/cucumber-js
  • 7 commits
  • 8 files changed
  • 0 commit comments
  • 1 contributor
View
17 History.md
@@ -2,11 +2,26 @@
## [v0.2](https://github.com/cucumber/cucumber-js/compare/v0.1.5...master)
-### [master (unreleased)](https://github.com/cucumber/cucumber-js/compare/v0.2.9...master)
+### [master (unreleased)](https://github.com/cucumber/cucumber-js/compare/v0.2.10...master)
**TBD**
+### [v0.2.10](https://github.com/cucumber/cucumber-js/compare/v0.2.9...v0.2.10)
+
+#### Fixes
+
+* Fix path handling on Windows platforms (close #47) (Julien Biezemans)
+
+#### Documentation, internals and tests
+
+* Add tagged hooks example to README (Julien Biezemans)
+* Fix browserify setup for example page load (Julien Biezemans)
+* Rename bundle to 'cucumber.js' in web example (Julien Biezemans)
+* Remove obsolete browserify directive (Julien Biezemans)
+* Improve platform detection (Julien Biezemans)
+
+
### [v0.2.9](https://github.com/cucumber/cucumber-js/compare/v0.2.8...v0.2.9)
View
21 README.md
@@ -274,6 +274,27 @@ myAroundHooks = function() {
module.exports = myAroundHooks;
```
+##### Tagged hooks
+
+Hooks can be conditionally elected for execution based on the tags of the scenario.
+
+``` javascript
+// features/support/hooks.js (this path is just a suggestion)
+
+var myHooks = function () {
+ this.Before("@foo", "@bar,@baz", function(callback) {
+ // This hook will be executed before scenarios tagged with @foo and either
+ // @bar or @baz.
+
+ // ...
+
+ callback();
+ });
+};
+
+module.exports = myHooks;
+```
+
### Run cucumber
Cucumber.js includes a binary file to execute the features.
View
2  example/index.html
@@ -6,7 +6,7 @@
<title>Cucumber.js</title>
<link href="example.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="vendor/jquery-1.6.1.min.js"></script>
- <script type="text/javascript" src="/browserify.js"></script>
+ <script type="text/javascript" src="/cucumber.js"></script>
<script type="text/javascript" src="/example.js"></script>
</head>
<body>
View
23 example/server.js
@@ -1,13 +1,16 @@
-var connect = require('connect');
-var server = connect.createServer();
+var connect = require('connect');
+var server = connect.createServer();
+var browserify = require('browserify');
-server.use(connect.static(__dirname));
-server.use(require('browserify')({
- require: ['cucumber-html',
- {'cucumber': './lib/cucumber.js'},
- {'./gherkin/lexer/en': 'gherkin/lib/gherkin/lexer/en'}],
+var port = process.env.PORT || 9797;
+var cukeBundle = browserify({
+ mount: '/cucumber.js',
+ require: ['cucumber-html', './lib/cucumber', {'./gherkin/lexer/en': 'gherkin/lib/gherkin/lexer/en'}],
ignore: ['./cucumber/cli', 'connect']
-}));
-var port = process.env.PORT || 9797;
+});
+
+server.use(connect.static(__dirname));
+server.use(cukeBundle);
server.listen(port);
-console.log('Accepting connection on port '+port+'...');
+
+console.log('Accepting connections on port ' + port + '...');
View
18 features/step_definitions/cli_steps.js
@@ -22,12 +22,21 @@ var cliSteps = function cliSteps() {
}
};
+ function isWindowsPlatform() {
+ return (process.platform == 'win32' || process.platform == 'win64');
+ };
+
+ function joinPathSegments(segments) {
+ var pathJoiner = isWindowsPlatform() ? "\\" : '/';
+ return segments.join(pathJoiner);
+ }
+
this.Given(/^a file named "(.*)" with:$/, function(filePath, fileContent, callback) {
cleanseIfNeeded();
var absoluteFilePath = tmpPath(filePath);
- var filePathParts = absoluteFilePath.split('/');
- var fileName = filePathParts.pop();
- var dirName = filePathParts.join('/');
+ var filePathSegments = absoluteFilePath.split('/');
+ var fileName = filePathSegments.pop();
+ var dirName = joinPathSegments(filePathSegments);
mkdirp(dirName, 0755, function(err) {
if (err) { throw new Error(err); }
fs.writeFile(absoluteFilePath, fileContent, function(err) {
@@ -40,7 +49,8 @@ var cliSteps = function cliSteps() {
this.When(/^I run `cucumber.js(| .+)`$/, function(args, callback) {
var initialCwd = process.cwd();
process.chdir(tmpDir);
- var command = baseDir + "/bin/cucumber.js" + args;
+ var runtimePath = joinPathSegments([baseDir, 'bin', 'cucumber.js']);
+ var command = "node \"" + runtimePath + "\"" + args;
exec(command,
function (error, stdout, stderr) {
lastRun['error'] = error;
View
2  lib/cucumber.js
@@ -16,6 +16,6 @@ Cucumber.Type = require('./cucumber/type');
Cucumber.Util = require('./cucumber/util');
Cucumber.VolatileConfiguration = require('./cucumber/volatile_configuration');
-Cucumber.VERSION = "0.2.9";
+Cucumber.VERSION = "0.2.10";
module.exports = Cucumber;
View
2  lib/cucumber/cli/argument_parser.js
@@ -101,7 +101,7 @@ var ArgumentParser = function(argv) {
};
ArgumentParser.NUMBER_OF_LEADING_ARGS_TO_SLICE = 2;
ArgumentParser.DEFAULT_FEATURES_DIRECTORY = "features";
-ArgumentParser.FEATURE_FILENAME_REGEXP = /\/[^\/]+\.feature$/i;
+ArgumentParser.FEATURE_FILENAME_REGEXP = /[\/\\][^\/\\]+\.feature$/i;
ArgumentParser.LONG_OPTION_PREFIX = "--";
ArgumentParser.REQUIRE_OPTION_NAME = "require";
ArgumentParser.REQUIRE_OPTION_SHORT_NAME = "r";
View
2  package.json
@@ -1,7 +1,7 @@
{ "name" : "cucumber"
, "description" : "The official JavaScript implementation of Cucumber."
, "keywords" : [ "testing", "bdd", "cucumber", "gherkin", "tests" ]
-, "version" : "0.2.9"
+, "version" : "0.2.10"
, "homepage" : "http://github.com/cucumber/cucumber-js"
, "author" : "Julien Biezemans <jb@jbpros.com> (http://jbpros.net)"
, "contributors" : [

No commit comments for this range

Something went wrong with that request. Please try again.