diff options
| author | Jez Ng | 2012-09-03 23:19:35 -0400 |
|---|---|---|
| committer | Jez Ng | 2012-09-08 04:30:26 -0400 |
| commit | 6df16c591219d87058b4c48682d503382e44693f (patch) | |
| tree | 3ec4044a51c557cd59df6d6a9ff712e6491a9c18 /Cakefile | |
| parent | 8437dd96144475343562c9a6aa2f14469bc75a56 (diff) | |
| download | vimium-6df16c591219d87058b4c48682d503382e44693f.tar.bz2 | |
Set up PhantomJS testing.
Diffstat (limited to 'Cakefile')
| -rw-r--r-- | Cakefile | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -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 |
