Vibrato BDD
This module is currently deprecated. Never progressed to do it because no time/motivation then I discover AVA.
About
A Behaviour Driven Development framework. Use it to write your specifications and tests directly in javascript using a fluent API, based on Gherkin syntax.
Why use Vibrato BDD ?
BDD and the Gherkin syntax are great tools. They allow you to clearly define what you need to test, and they force you to think how your code will work before starting to write it.
But... They also imply that you have to write a plain text description of the behaviour, due to the fact you work with some non-technical profiles. Then you have to rewrite in part the same lines for your tests...
For developers who want to take advantages of BDD, Vibrato BDD can avoid the duplicate content and the extra step in test process that represents a plain text behaviour description.
Install
npm install vibrato-bdd
How to use
-
First, create a "test" directory at root of your project
-
then, write your features scenario in distinct files in a "test-suite" directory for example (but organize them as you want)
/* my-project/test/test-suite/my-feature-test.js */describe"In order to know if two objects are identical""As a developer""I Want to deeply compare these two ojects" -
add a file index.js in the "test" directory, to initialize your resources and the tests you want to run
/* my-project/test/index.js */'My framework'//create an instance of vibrato-bdd with an identifier//deepEqual will be accessible in the this object of your step definitions//Choose the features tests you want to test, using a require;//then just launch your test suite -
go back to your feature test file and write your step definitions
/* my-project/test/test-suite/my-feature-test.js *///import your favorite assertion modulevar assert = ;//add this line to retrieve your vibrato-bdd instance'My framework'describe"In order to know if two objects are identical""As a developer""I Want to deeply compare these two ojects"//write your step definition directly here{var objectOne = name : "luke" mother : name : "padme"objectTwo = name : "luke" mother : name : "padme";;//you can pass value througt the steps with the next callback}{var resultOfComparison = this//you can access to your resources througt the this context;}{assert;;//same callback as next//but named differently to mark the end of current scenario} -
run the following basic command to launch the test suite:
node test