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 ...@@ -12,7 +12,8 @@ node_modules
components components
docs/doctrees/environment.pickle docs/doctrees/environment.pickle
tags tags
test-reports stamp-npm
stamp-bower
# OSX # OSX
.DS_Store .DS_Store
...@@ -5,6 +5,7 @@ PAPER = ...@@ -5,6 +5,7 @@ PAPER =
BUILDDIR = ./docs BUILDDIR = ./docs
BOWER ?= node_modules/.bin/bower BOWER ?= node_modules/.bin/bower
PHANTOMJS ?= node_modules/.bin/phantomjs
# Internal variables. # Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_a4 = -D latex_paper_size=a4
...@@ -51,13 +52,37 @@ release: ...@@ -51,13 +52,37 @@ release:
sed -i "s/(Unreleased)/(`date +%Y-%m-%d`)/" docs/CHANGES.rst sed -i "s/(Unreleased)/(`date +%Y-%m-%d`)/" docs/CHANGES.rst
grunt minify grunt minify
dev:
########################################################################
## Install dependencies
stamp-npm: package.json
npm install 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)/* -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: html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo @echo
......
...@@ -3,21 +3,11 @@ config.paths.mock = "tests/mock"; ...@@ -3,21 +3,11 @@ config.paths.mock = "tests/mock";
config.paths.utils = "tests/utils"; config.paths.utils = "tests/utils";
config.paths.jasmine = "components/jasmine/lib/jasmine-core/jasmine"; config.paths.jasmine = "components/jasmine/lib/jasmine-core/jasmine";
config.paths["jasmine-html"] = "components/jasmine/lib/jasmine-core/jasmine-html"; 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["console-runner"] = "node_modules/phantom-jasmine/lib/console-runner";
config.paths["jasmine-junit-reporter"] = "node_modules/jasmine-reporters/src/jasmine.junit_reporter";
config.shim['jasmine-html'] = { config.shim['jasmine-html'] = {
deps: ['jasmine'], deps: ['jasmine'],
exports: '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); require.config(config);
// Polyfill 'bind' which is not available in phantomjs < 2.0 // Polyfill 'bind' which is not available in phantomjs < 2.0
...@@ -47,6 +37,7 @@ require([ ...@@ -47,6 +37,7 @@ require([
"jasmine-html" "jasmine-html"
], function($, converse, mock, jasmine) { ], function($, converse, mock, jasmine) {
// Set up converse.js // Set up converse.js
$.fx.off = true;
window.converse_api = converse; window.converse_api = converse;
window.localStorage.clear(); window.localStorage.clear();
converse.initialize({ converse.initialize({
...@@ -68,8 +59,7 @@ require([ ...@@ -68,8 +59,7 @@ require([
} }
}; };
require([ require([
"jasmine-console-reporter", "console-runner",
"jasmine-junit-reporter",
"spec/converse", "spec/converse",
"spec/otr", "spec/otr",
"spec/eventemitter", "spec/eventemitter",
...@@ -82,19 +72,19 @@ require([ ...@@ -82,19 +72,19 @@ require([
// Jasmine stuff // Jasmine stuff
var jasmineEnv = jasmine.getEnv(); var jasmineEnv = jasmine.getEnv();
var reporter;
if (/PhantomJS/.test(navigator.userAgent)) { if (/PhantomJS/.test(navigator.userAgent)) {
jasmineEnv.addReporter(new jasmine.TrivialReporter()); reporter = new jasmine.ConsoleReporter();
jasmineEnv.addReporter(new jasmine.JUnitXmlReporter('./test-reports/')); window.console_reporter = reporter;
jasmineEnv.addReporter(new jasmine.ConsoleReporter()); jasmineEnv.addReporter(reporter);
jasmineEnv.updateInterval = 0; jasmineEnv.updateInterval = 0;
} else { } else {
var htmlReporter = new jasmine.HtmlReporter(); reporter = new jasmine.HtmlReporter();
jasmineEnv.addReporter(htmlReporter); jasmineEnv.addReporter(reporter);
jasmineEnv.addReporter(new jasmine.ConsoleReporter());
jasmineEnv.specFilter = function(spec) { jasmineEnv.specFilter = function(spec) {
return htmlReporter.specFilter(spec); return reporter.specFilter(spec);
}; };
jasmineEnv.updateInterval = 100; jasmineEnv.updateInterval = 0;
} }
jasmineEnv.execute(); 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