aboutsummaryrefslogtreecommitdiffstats
path: root/Cakefile
diff options
context:
space:
mode:
authorJez Ng2012-11-02 23:39:09 -0400
committerJez Ng2012-11-02 23:42:37 -0400
commit63391fb9b9cf0e13d26c4bfd90e9d5da4dd1e93b (patch)
tree49c8c11371cad35ffd22c01914521e31e90b57a7 /Cakefile
parent89d3c53fadfd6419c8c6e43af8ace7707deec012 (diff)
downloadvimium-63391fb9b9cf0e13d26c4bfd90e9d5da4dd1e93b.tar.bz2
Add ability to filter tests by name.
Diffstat (limited to 'Cakefile')
-rw-r--r--Cakefile9
1 files changed, 5 insertions, 4 deletions
diff --git a/Cakefile b/Cakefile
index bf096e3f..012bd459 100644
--- a/Cakefile
+++ b/Cakefile
@@ -67,17 +67,18 @@ task "package", "build .crx file", ->
crxmake.on "exit", -> fs.writeFileSync "manifest.json", origManifestText
-runUnitTests = (projectDir=".") ->
+runUnitTests = (projectDir=".", testNameFilter) ->
console.log "Running unit tests..."
basedir = path.join projectDir, "/tests/unit_tests/"
test_files = fs.readdirSync(basedir).filter((filename) -> filename.indexOf("_test.js") > 0)
test_files = test_files.map((filename) -> basedir + filename)
test_files.forEach (file) -> require (if file[0] == '/' then '' else './') + file
- Tests.run()
+ Tests.run(testNameFilter)
return Tests.testsFailed
-task "test", "run all tests", ->
- unitTestsFailed = runUnitTests()
+option '', '--filter-tests [string]', 'filter tests by matching string'
+task "test", "run all tests", (options) ->
+ unitTestsFailed = runUnitTests('.', options['filter-tests'])
console.log "Running DOM tests..."
phantom = spawn "phantomjs", ["./tests/dom_tests/phantom_runner.js"]