Skip to content

Jon-Biz/jasmine-every

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 

jasmine-every

A helper function for Jasmine to allow one to iterate a test or suite through an array of test case data.

You pass every an array of test data, along with a callback containing tests and suites, and it iterates through the array, applying the tests to each case of data. To wit:

var testcases = ["dataset_one","dataset_two","dataset_three"]

every(testcases,function(index, testcase){
  describe("each Test Case",function(){
    it("should be a string",function(){
      expect(typeof testcase).toEqual("string");
    })
  })  
};

There's more

Something is broken, and you want to temporarily step through just one your testcases without dismantling test data or the test suite. To do so, simply pass every the array position of the case you want to run and it will run just that. To run the third case in your array of test cases:

every(testcase, 2,function(index,testcase){
  // tests go here
});

It can also take an array, if there are a specific set of tests you want to run. So, to iterate through the first three cases:

every(testcase,[0,1,2],function(index,testcase){
  // tests go here
});

Installation

Include this wherever you are including your jasmine files.

About

A helper function for Jasmine to allow one to iterate a test or suite through an array of test case data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published