aboutsummaryrefslogtreecommitdiffstats
path: root/Cakefile
diff options
context:
space:
mode:
authorJez Ng2012-09-03 23:19:35 -0400
committerJez Ng2012-09-08 04:30:26 -0400
commit6df16c591219d87058b4c48682d503382e44693f (patch)
tree3ec4044a51c557cd59df6d6a9ff712e6491a9c18 /Cakefile
parent8437dd96144475343562c9a6aa2f14469bc75a56 (diff)
downloadvimium-6df16c591219d87058b4c48682d503382e44693f.tar.bz2
Set up PhantomJS testing.
Diffstat (limited to 'Cakefile')
-rw-r--r--Cakefile20
1 files changed, 15 insertions, 5 deletions
diff --git a/Cakefile b/Cakefile
index 697c03dc..1c324497 100644
--- a/Cakefile
+++ b/Cakefile
@@ -55,10 +55,20 @@ task "package", "build .crx file", ->
crxmake.stdout.on "data", (data) -> console.log data.toString().trim()
crxmake.on "exit", -> fs.writeFileSync "manifest.json", orig_manifest_text
-task "test", "run all unit tests", ->
- test_files = fs.readdirSync("tests/").filter((filename) -> filename.indexOf("_test.js") > 0)
- test_files = test_files.map((filename) -> "tests/" + filename)
+task "test", "run all tests", ->
+ console.log "Running unit tests..."
+ basedir = "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 "./" + file
Tests.run()
- if Tests.testsFailed > 0
- process.exit 1
+ returnCode = if Tests.testsFailed > 0 then 1 else 0
+
+ console.log "Running DOM tests..."
+ spawn = (require "child_process").spawn
+ phantom = spawn "phantomjs", ["./tests/dom_tests/phantom_runner.js"]
+ phantom.stdout.on 'data', (data) -> process.stdout.write data
+ phantom.stderr.on 'data', (data) -> process.stderr.write data
+ phantom.on 'exit', (code) ->
+ returnCode += code
+ process.exit returnCode