Commit e907bec4 authored by JC Brand's avatar JC Brand

Run tests using chromium headless.

parent 1a95472e
dist: trusty
language: node_js
cache:
bundler: true
directories:
- node_modules
addons:
chrome: stable
node_js:
- 6
before_script: make dev
before_install:
- export DISPLAY=:99.0
install: make dev
before_script: make serve_bg
script: make check
sudo: false
# You can set these variables from the command line.
BUILDDIR = ./docs
BUNDLE ?= ./.bundle/bin/bundle
GRUNT ?= ./node_modules/.bin/grunt
HTTPSERVE ?= ./node_modules/.bin/http-server
ESLINT ?= ./node_modules/.bin/eslint
PAPER =
PHANTOMJS ?= ./node_modules/.bin/phantomjs
RJS ?= ./node_modules/.bin/r.js
PO2JSON ?= ./node_modules/.bin/po2json
SASS ?= ./.bundle/bin/sass
CLEANCSS ?= ./node_modules/clean-css-cli/bin/cleancss --skip-rebase
SPHINXBUILD ?= ./bin/sphinx-build
SPHINXOPTS =
BUILDDIR = ./docs
BUNDLE ?= ./.bundle/bin/bundle
GRUNT ?= ./node_modules/.bin/grunt
HTTPSERVE ?= ./node_modules/.bin/http-server
ESLINT ?= ./node_modules/.bin/eslint
PAPER =
CHROMIUM ?= ./node_modules/.bin/run-headless-chromium
RJS ?= ./node_modules/.bin/r.js
PO2JSON ?= ./node_modules/.bin/po2json
SASS ?= ./.bundle/bin/sass
CLEANCSS ?= ./node_modules/clean-css-cli/bin/cleancss --skip-rebase
SPHINXBUILD ?= ./bin/sphinx-build
SPHINXOPTS =
# Internal variables.
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) ./docs/source
......@@ -47,8 +47,12 @@ help:
## Miscellaneous
.PHONY: serve
serve: stamp-npm
$(HTTPSERVE) -p 8000 -c -1
serve: dev
$(HTTPSERVE) -p 8000 -c-1
.PHONY: serve_bg
serve_bg: dev
$(HTTPSERVE) -p 8000 -c-1 -s &
########################################################################
## Translation machinery
......@@ -189,7 +193,7 @@ eslint: stamp-npm
.PHONY: check
check: eslint
$(PHANTOMJS) tests/run-jasmine2.js tests.html
LOG_CR_VERBOSITY=INFO $(CHROMIUM) http://localhost:8000/tests.html
########################################################################
......
......@@ -8,6 +8,7 @@ config.paths.sinon = "node_modules/sinon/pkg/sinon";
config.paths.transcripts = "converse-logs/converse-logs";
config.paths.jasmine = "node_modules/jasmine-core/lib/jasmine-core/jasmine";
config.paths.boot = "node_modules/jasmine-core/lib/jasmine-core/boot";
config.paths["jasmine-console"] = "node_modules/jasmine-core/lib/console/console";
config.paths["jasmine-html"] = "node_modules/jasmine-core/lib/jasmine-core/jasmine-html";
// config.paths["console-runner"] = "node_modules/phantom-jasmine/lib/console-runner";
config.shim.jasmine = {
......@@ -17,15 +18,15 @@ config.shim['jasmine-html'] = {
deps: ['jasmine'],
exports: 'window.jasmineRequire'
};
config.shim.boot = {
deps: ['jasmine', 'jasmine-html'],
config.shim['jasmine-console'] = {
deps: ['jasmine'],
exports: 'window.jasmineRequire'
};
/*
config.shim['console-runner'] = {
deps: ['jasmine']
config.shim.boot = {
deps: ['jasmine', 'jasmine-html', 'jasmine-console'],
exports: 'window.jasmine'
};
*/
require.config(config);
// Polyfill 'bind' which is not available in phantomjs < 2.0
......@@ -79,11 +80,24 @@ require(['jquery', 'mock', 'boot', 'sinon', 'wait-until-promise'],
window.localStorage.clear();
window.sessionStorage.clear();
var jasmineEnv = jasmine.getEnv();
var ConsoleReporter = window.jasmineRequire.ConsoleReporter();
var consoleReporter = new ConsoleReporter({
print: function print(message) {
console.log(message + '\x03\b');
},
onComplete: function onComplete(isSuccess) {
var exitCode = isSuccess ? 0 : 1;
console.info('All tests completed!' + exitCode);
},
showColors: true
});
jasmineEnv.addReporter(consoleReporter);
// Load the specs
require(specs, function () {
// Initialize the HTML Reporter and execute the environment (setup by `boot.js`)
// http://stackoverflow.com/questions/19240302/does-jasmine-2-0-really-not-work-with-require-js
window.onload();
});
}
);
// Initialize the HTML Reporter and execute the environment (setup by `boot.js`)
// http://stackoverflow.com/questions/19240302/does-jasmine-2-0-really-not-work-with-require-js
window.onload();
});
});
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