Add jasmine and jasmine-html as require deps. Also add Console reporter

This commit is contained in:
JC Brand 2013-07-28 21:20:36 +02:00
parent 8f8ecbd78c
commit 143875bf32
3 changed files with 41 additions and 5 deletions

View File

@ -30,6 +30,8 @@
"grunt-cli": "~0.1.9",
"grunt": "~0.4.1",
"grunt-contrib-jshint": "~0.6.0",
"phantomjs": "~1.9.1-0"
"phantomjs": "~1.9.1-0",
"phantom-jasmine": "~0.3.0",
"jasmine-reporters": "~0.2.1"
}
}

View File

@ -6,8 +6,6 @@
<meta name="description" content="Converse.js: Open Source Browser-Based Instant Messaging" />
<link rel="shortcut icon" type="image/png" href="Libraries/jasmine-1.3.1/jasmine_favicon.png">
<link rel="stylesheet" type="text/css" href="Libraries/jasmine-1.3.1/jasmine.css">
<script type="text/javascript" src="Libraries/jasmine-1.3.1/jasmine.js"></script>
<script type="text/javascript" src="Libraries/jasmine-1.3.1/jasmine-html.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="stylesheets/stylesheet.css">
<link rel="stylesheet" type="text/css" media="screen" href="converse.css">
<script data-main="tests_main" src="Libraries/require-jquery.js"></script>

View File

@ -1,4 +1,39 @@
require(["jquery", "converse", "mock", "spec/MainSpec", "spec/ChatRoomSpec"], function($, converse, mock_connection) {
require.config({
paths: {
"jasmine": "Libraries/jasmine-1.3.1/jasmine",
"jasmine-html": "Libraries/jasmine-1.3.1/jasmine-html",
"jasmine-console-reporter": "node_modules/jasmine-reporters/src/jasmine.console_reporter",
"jasmine-junit-reporter": "node_modules/jasmine-reporters/src/jasmine.junit_reporter"
},
// define module dependencies for modules not using define
shim: {
'jasmine-html': {
deps: ['jasmine'],
exports: 'jasmine'
},
'jasmine-console-reporter': {
deps: ['jasmine-html'],
exports: 'jasmine'
},
'jasmine-junit-reporter': {
deps: ['jasmine-html'],
exports: 'jasmine'
}
}
});
require([
"jquery",
"converse",
"mock",
"jasmine-html",
"jasmine-console-reporter",
"jasmine-junit-reporter",
"spec/MainSpec",
"spec/ChatRoomSpec"
], function($, converse, mock_connection, jasmine) {
// Set up converse.js
window.localStorage.clear();
converse.initialize({
@ -14,11 +49,12 @@ require(["jquery", "converse", "mock", "spec/MainSpec", "spec/ChatRoomSpec"], fu
jasmineEnv.updateInterval = 250;
if (/PhantomJS/.test(navigator.userAgent)) {
jasmineEnv.addReporter(new jasmine.TrivialReporter());
jasmineEnv.addReporter(new jasmine.JUnitXmlReporter('target/test-reports/'));
// jasmineEnv.addReporter(new jasmine.JUnitXmlReporter('target/test-reports/'));
jasmineEnv.addReporter(new jasmine.ConsoleReporter());
} else {
var htmlReporter = new jasmine.HtmlReporter();
jasmineEnv.addReporter(htmlReporter);
jasmineEnv.addReporter(new jasmine.ConsoleReporter());
jasmineEnv.specFilter = function(spec) {
return htmlReporter.specFilter(spec);
};