aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Crosby2014-08-12 08:28:42 -0700
committerPhil Crosby2014-08-12 08:28:42 -0700
commitbe76291cfdbae4ce142efe2ab35795fff91e12e6 (patch)
tree954c65df8cca963e20fe8803a636fb924d107deb
parent4ab75878b3d59c0f970195bfae191781e0b9f5b3 (diff)
parent06729270f7e3968d9a6bd6c8ec8d47f3afe97bd7 (diff)
downloadvimium-be76291cfdbae4ce142efe2ab35795fff91e12e6.tar.bz2
Merge pull request #922 from camflint/FixBuildAndTestTasksOnWindows
Fix build and test tasks on Windows
-rw-r--r--.gitignore1
-rw-r--r--CONTRIBUTING.md3
-rw-r--r--Cakefile6
-rw-r--r--tests/dom_tests/phantom_runner.coffee15
4 files changed, 19 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
index 9ac3be14..9df0d559 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,5 +3,6 @@
*.swp
*.crx
*.js
+*.sublime*
node_modules/*
dist
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 2efe73a2..03ac26e9 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -36,7 +36,8 @@ install Vimium from source:
Our tests use [shoulda.js](https://github.com/philc/shoulda.js) and [PhantomJS](http://phantomjs.org/). To run the tests:
1. `git submodule update --init --recursive` -- this pulls in shoulda.js.
- 1. [Install PhantomJS.](http://phantomjs.org/download.html)
+ 1. Install [PhantomJS](http://phantomjs.org/download.html).
+ 1. `npm install path` to install the [Node.js Path module](http://nodejs.org/api/path.html), used by the test runner.
1. `cake build` to compile `*.coffee` to `*.js`
1. `cake test` to run the tests.
diff --git a/Cakefile b/Cakefile
index bae79009..0fa75e24 100644
--- a/Cakefile
+++ b/Cakefile
@@ -1,8 +1,14 @@
+util = require "util"
fs = require "fs"
path = require "path"
child_process = require "child_process"
spawn = (procName, optArray, silent=false) ->
+ if process.platform is "win32"
+ # if win32, prefix arguments with "/c {original command}"
+ # e.g. "coffee -c c:\git\vimium" becomes "cmd.exe /c coffee -c c:\git\vimium"
+ optArray.unshift "/c", procName
+ procName = "cmd.exe"
proc = child_process.spawn procName, optArray
unless silent
proc.stdout.on 'data', (data) -> process.stdout.write data
diff --git a/tests/dom_tests/phantom_runner.coffee b/tests/dom_tests/phantom_runner.coffee
index 91eeb526..d05d9ab4 100644
--- a/tests/dom_tests/phantom_runner.coffee
+++ b/tests/dom_tests/phantom_runner.coffee
@@ -1,5 +1,6 @@
system = require 'system'
fs = require 'fs'
+path = require 'path'
page = require('webpage').create()
page.settings.userAgent = 'phantom'
@@ -12,12 +13,16 @@ page.viewportSize =
page.onConsoleMessage = (msg) ->
console.log msg
-dirname = do ->
- pathParts = system.args[0].split(fs.separator)
- pathParts[pathParts.length - 1] = ''
- pathParts.join(fs.separator)
+page.onError = (msg, trace) ->
+ console.log(msg);
+ trace.forEach (item) ->
+ console.log(' ', item.file, ':', item.line)
-page.open dirname + 'dom_tests.html', (status) ->
+page.onResourceError = (resourceError) ->
+ console.log(resourceError.errorString)
+
+testfile = path.join(path.dirname(system.args[0]), 'dom_tests.html')
+page.open testfile, (status) ->
if status != 'success'
console.log 'Unable to load tests.'
phantom.exit 1