2013-09-22 15 views
6

Birden çok sınama ile nodeunit sınama dosyasından yalnızca bir sınama çalıştırılabilir mi? Benim tests.js dosyası:Bir tek düğümlü dosyadan bir sınama gerçekleştirin

module.exports = { 
    test2: function (test) { 
     console.log ("test2") 
     test.done(); 
    }, 
    test1: function (test) { 
     console.log ("test1") 
     test.done(); 
    } 
}; 

Bütün testler çalıştırabilirsiniz:

$ nodeunit tests.js 

Ama çalıştırmak istiyorum sadece dnm2 gibi:

$ nodeunit tests.js test2 

ayrı 2 dosyayı tests.js çatlıyor olmadan mümkün mü Dosyalar?

cevap

6

mevcut seçenekler için (Bu sürümde 0.8.1 içindir) -h nodeunit bakınız:

Usage: nodeunit [options] testmodule1.js testfolder [...] 
Options: 

    --config FILE  the path to a JSON file with options 
    --reporter FILE optional path to a reporter file to customize the output 
    --list-reporters list available build-in reporters 
    -t name,   specify a test to run 
    -f fullname,  specify a specific test to run. fullname is built so: "outerGroup - .. - innerGroup - testName" 
    -h, --help  display this help and exit 
    -v, --version  output version information and exit 

Yani o istediğini yapmalıdır aşağıdadır:

$ nodeunit tests.js -t test2 

örn :

$ nodeunit ./tests.js -t test2 

tests.js 
test2 
✔ test2 
İlgili konular