Commit 53a8f288 authored by JC Brand's avatar JC Brand

Better phantomjs test runnning and reporting

* Use phantom-jasmine instead of jasmine-reporters
* Update Makefile to use the test runner from phantom-jasmine
* Use newest phantomjs
* Use latest bower
* Turn of jquery effects when testing
parent a9da15bb
......@@ -12,7 +12,8 @@ node_modules
components
docs/doctrees/environment.pickle
tags
test-reports
stamp-npm
stamp-bower
# OSX
.DS_Store
......@@ -5,6 +5,7 @@ PAPER =
BUILDDIR = ./docs
BOWER ?= node_modules/.bin/bower
PHANTOMJS ?= node_modules/.bin/phantomjs
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
......@@ -51,13 +52,37 @@ release:
sed -i "s/(Unreleased)/(`date +%Y-%m-%d`)/" docs/CHANGES.rst
grunt minify
dev:
########################################################################
## Install dependencies
stamp-npm: package.json
npm install
${BOWER} update;
touch stamp-npm
clean:
stamp-bower: stamp-npm bower.json
$(BOWER) install
touch stamp-bower
clean::
rm -f stamp-npm stamp-bower
rm -rf node_modules components
-rm -rf $(BUILDDIR)/*
dev: clean
npm install
${BOWER} update;
########################################################################
## Tests
check:: stamp-npm
$(PHANTOMJS) node_modules/phantom-jasmine/lib/run_jasmine_test.coffee tests.html
########################################################################
## Documentation
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
......
......@@ -3,21 +3,11 @@ config.paths.mock = "tests/mock";
config.paths.utils = "tests/utils";
config.paths.jasmine = "components/jasmine/lib/jasmine-core/jasmine";
config.paths["jasmine-html"] = "components/jasmine/lib/jasmine-core/jasmine-html";
config.paths["jasmine-console-reporter"] = "node_modules/jasmine-reporters/src/jasmine.console_reporter";
config.paths["jasmine-junit-reporter"] = "node_modules/jasmine-reporters/src/jasmine.junit_reporter";
config.paths["console-runner"] = "node_modules/phantom-jasmine/lib/console-runner";
config.shim['jasmine-html'] = {
deps: ['jasmine'],
exports: 'jasmine'
};
config.shim['jasmine-console-reporter'] = {
deps: ['jasmine-html'],
exports: 'jasmine'
};
config.shim['jasmine-junit-reporter'] = {
deps: ['jasmine-html'],
exports: 'jasmine'
};
require.config(config);
// Polyfill 'bind' which is not available in phantomjs < 2.0
......@@ -27,8 +17,8 @@ if (!Function.prototype.bind) {
// closest thing possible to the ECMAScript 5 internal IsCallable function
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
}
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
fNOP = function () {},
fBound = function () {
return fToBind.apply(this instanceof fNOP && oThis ? this : oThis,
......@@ -47,6 +37,7 @@ require([
"jasmine-html"
], function($, converse, mock, jasmine) {
// Set up converse.js
$.fx.off = true;
window.converse_api = converse;
window.localStorage.clear();
converse.initialize({
......@@ -64,12 +55,11 @@ require([
var i;
for (i=0, len=buf.length; i<len; i++) {
buf[i] = Math.floor(Math.random()*256);
}
}
}
};
require([
"jasmine-console-reporter",
"jasmine-junit-reporter",
"console-runner",
"spec/converse",
"spec/otr",
"spec/eventemitter",
......@@ -82,19 +72,19 @@ require([
// Jasmine stuff
var jasmineEnv = jasmine.getEnv();
var reporter;
if (/PhantomJS/.test(navigator.userAgent)) {
jasmineEnv.addReporter(new jasmine.TrivialReporter());
jasmineEnv.addReporter(new jasmine.JUnitXmlReporter('./test-reports/'));
jasmineEnv.addReporter(new jasmine.ConsoleReporter());
reporter = new jasmine.ConsoleReporter();
window.console_reporter = reporter;
jasmineEnv.addReporter(reporter);
jasmineEnv.updateInterval = 0;
} else {
var htmlReporter = new jasmine.HtmlReporter();
jasmineEnv.addReporter(htmlReporter);
jasmineEnv.addReporter(new jasmine.ConsoleReporter());
reporter = new jasmine.HtmlReporter();
jasmineEnv.addReporter(reporter);
jasmineEnv.specFilter = function(spec) {
return htmlReporter.specFilter(spec);
return reporter.specFilter(spec);
};
jasmineEnv.updateInterval = 100;
jasmineEnv.updateInterval = 0;
}
jasmineEnv.execute();
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment