Is there a way to make the setUp and tearDown methods on the ribbon?

I am using tape for testing in JavaScript, but in some cases I want to set some config variables available in all tests in the file. Something like the setUp and tearDown methods available in PhpUnit. These methods will run before and after each test in the file, respectively.

eg:

test("setUp", function(t){
    var person = {name: 'Jose', programmer: true};
});

test("Name isn't undefined", function(){
    t.notEqual(person.name, undefined);
});

test("Is a programmer", function(t){
    t.ok(person.programmer);
});

test("tearDown", function(){
    //Do something else
});

      

+3


source to share


1 answer


It's too late for an answer, but yes. substack itself.

Basically you just write it just like another test spec, but with setup

and teardown

.



test('setup', function(t){
t.end();
});
test('teardown', function(t){
t.end();
});

      

+3


source







All Articles