Skip to content

Latest commit

 

History

History
189 lines (162 loc) · 5.9 KB

release-notes.md

File metadata and controls

189 lines (162 loc) · 5.9 KB

Release Notes

Yadda 0.5.0

  • This adds the feature title to the output from the text parser contributed by akikhtenko (thanks). Since this changes the object structure returned by TextParser.parse() if you're using the TextParser directly rather than via the Mocha or Casper plugins, it's a breaking change, but the change is very minor...
        var scenarios = parser.parse(text); // < 0.5.0
        var scenarios = parser.parse(text).scenarios; // >= 0.5.0

Yadda 0.4.7

  • The stable version of casperjs is no longer recommended by the casperjs author. It's also problematic to require modules. The latest version of casperjs (installed from master after 13th September 2013) fixes these problems, so I've updated the example to reflect this.

Yadda 0.4.6

Yadda 0.4.5

  • Fixed scenario parsing on windows bug. See Issue 6. Thanks grofit.

Yadda 0.4.4

  • Changed the CasperPlugin API

Yadda 0.4.3

  • Changed the MochaPlugin API

Yadda 0.4.2

  • TextParser no longer maintains state between parses

Yadda 0.4.1

  • Stopped pending asynchronous steps hanging the test run
  • Added mocha plugin

Yadda 0.4.0

  • Yadda now supports both asynchronous and synchronous usage
  • Deleted the before and after hook (after cannot be guaranteed to run when asynchronous)

Breaking API Changes

Removal of before and after hooks

The before and after hooks have been removed because after cannot be guaranteed to run when yadda is asynchronous. Use your test runner's before and after mechanism instead.

Removal of non-object contexts

You can no longer pass non-object contexts to yadda, i.e. instead of...

library.define('blah blah blah') function() {
    this.assert();
});
new Yadda(library).('blah blah blah', test);

Do...

library.define('blah blah blah') function() {
    this.test.assert();
});
new Yadda(library).('blah blah blah', { test: test });

Yadda 0.3.0

  • Re-implemented as a nodejs module
  • Used browserify for compatability with browser test frameworks like qunit

Breaking API Changes

Yadda has been re-implemented as a nodejs module. This means that the global 'Yadda' prefixed class names are no longer exposed and that all Yadda classes must be explicitly 'required'

In a node environment this is straightforward...

npm install yadda
var Yadda = require('yadda').Yadda;
var Library = require('yadda').Library;

var library = new Library();
library.given('$NUM bottles of beer', function(n) {
  console.log(n + ' ' + 'bottles of beer');
})
new Yadda(library).yadda('100 bottles of beer');

Thanks to browserify it straightforward from a browser environment too...

<head>
  <script src="http://www.github.com/acuminous/yadda/dist/yadda-0.3.0.js"></script>
  <script type="text/javascript">
    var Yadda = require('yadda').Yadda;
    var Library = require('yadda').Library;

    var library = new Library();
    library.given('$NUM bottles of beer', function(n) {
      console.log(n + ' ' + 'bottles of beer');
    })
    new Yadda(library).yadda('100 bottles of beer');
  </script>
</head>

In a CasperJS environment it's less straightforward. We haven't found how to get casper to understand commonjs or umd node modules and Casper's 'require' function clashes with the one created by browserify. For the moment we're working around this with the following ugly hack...

var oldRequire = require;
phantom.injectJs('../../dist/yadda-0.3.0.js');
window.Yadda = require('yadda').Yadda;
window.CasperPlugin = require('yadda').plugins.CasperPlugin;
window.Library = require('yadda').Library;
window.require = oldRequire;

library.given('$NUM bottles of beer', function(n) {
  console.log(n + ' ' + 'bottles of beer');
};
var yadda = new Yadda(library).yadda('100 bottles of beer');
casper = new CasperPlugin(yadda, casper).init();

Yadda 0.2.2

  • Added a feature file parser
  • Improved documentation and examples

Yadda 0.2.1

  • Added a CoffeeScript example
  • Added a Nodeunit example
  • Added a Mocha example
  • Added a new context variable to the interpret method. See Nodeunit example for usage.
  • Ensured that Yadda.after is called even if an error occurs
  • Fixed distance_table typo

Yadda 0.2.0

Breaking API Changes

In Yadda 0.1.0 you invoked yadda with

new Yadda(steps).yadda(["some scenario"]);

The equivalent syntax in 0.2.2 is

new Yadda.yadda(library).yadda(["some scenario"]);

where library is an instance of Yadda.Library

Combining Steps / Libraries

var steps = new Steps();
steps.importSteps(other_steps);
var yadda = new Yadda(steps);

Now you pass yadda an array of libraries instead of a single merged one

var lib1 = new Yadda.Library();
var lib2 = new Yadda.Library();
var yadda = new Yadda().yadda([lib1, lib2]);

alternatively you can do

var yadda = new Yadda.yadda();
yadda.requires(lib1);
yadda.requires(lib2);

or

var yadda = new Yadda.yadda();
yadda.requires([lib1, lib2]);

Defining Steps

Previously you defined steps using the addStep method, or a given, when, then helper method, e.g.

steps.addStep('some text', function() {
    // some code
})

Step.addStep has been replaced with Library.define

library.define('some text', function() {
    // some code
})

The helper methods are no longer available by default, but you can restore them by including yadda-0.2.2-localisation.js and creating your libraries as instances of Yadda.Library.English, e.g.

var library = new Yadda.Library.English()
    .given('a (\\d+) green bottles', function() {
        // some code
    }).when('(\\d+) falls', function() {
        // some code
    }).then('there are (\\d+) green bottles', function() {
        // some code
    });