azer / prova

Test runner based on Tape and Browserify
Other
333 stars 30 forks source link

grep doesn't work with nested tests #61

Open jfirebaugh opened 9 years ago

jfirebaugh commented 9 years ago

test.js:

var test = require('prova');

test('a', function(t) {
    t.test('b', function(t) {
        t.equal(2 + 2, 4);
        t.end();
    });
});

I expect -g b to run this test, but:

$ prova test.js 

    1 passed assertions.

$ prova test.js -g b

    0 passed assertions.
azer commented 9 years ago

someone else mentioned this before but I never use nested tests personally

jfirebaugh commented 9 years ago

It's pretty common to approximate a BDD syntax like mocha:

test('Array', function(t){
  t.test('#indexOf()', function(t){
    t.test('returns -1 when the value is not present', function(){
      t.equal(-1, [1,2,3].indexOf(5));
      t.equal(-1, [1,2,3].indexOf(0));
      t.end();
    })
  })
})
azer commented 9 years ago

yeah... I just do like test('index of returns #@$!%. u can send a PR for this if you'd like to have this feature