d103ca14 by Michael Richards

Include jasmine-helper.js in spec/lib to support running the spec suite in the c…

…onsole via PhantomJS.
1 parent 085e33ce
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
8 8
9 <script type="text/javascript" src="lib/jasmine.js"></script> 9 <script type="text/javascript" src="lib/jasmine.js"></script>
10 <script type="text/javascript" src="lib/jasmine-html.js"></script> 10 <script type="text/javascript" src="lib/jasmine-html.js"></script>
11 <script type="text/javascript" src="lib/jasmine-helper.js"></script>
11 12
12 <script type="text/javascript" src="../lib/rivets.js"></script> 13 <script type="text/javascript" src="../lib/rivets.js"></script>
13 14
......
1 /*
2 * Is injected into the spec runner file
3
4 * Copyright (c) 2012 Camille Reynders
5 * Copyright (c) 2012 "Cowboy" Ben Alman
6 * Licensed under the MIT license.
7 * http://benalman.com/about/license/
8 */
9
10 /*global jasmine:true, alert:true*/
11
12 // Send messages to the parent phantom.js process via alert! Good times!!
13 function sendMessage(){
14 var args = [].slice.call( arguments );
15 alert( JSON.stringify( args ) );
16 }
17
18 var GruntReporter = function(){
19 this._started = this._getTime();
20 };
21 GruntReporter.prototype = {
22 _getTime : function(){
23 return new Date().getTime();
24 },
25 /**
26 * @param {jasmine.Suite} suite
27 */
28 _getSuitesToRoot : function( suite ){
29 var result = [];
30 do{
31 result.unshift( suite.description );
32 suite = suite.parentSuite;
33 }while( suite );
34 return result;
35 },
36 /**
37 * @param {jasmine.Suite} suite
38 */
39 reportRunnerResults : function( runner ){
40 var elapsed = this._getTime() - this._started;
41 sendMessage( 'done', elapsed );
42 },
43 /**
44 *
45 * @param {jasmine.Spec} spec
46 */
47 reportSpecResults : function( spec ){
48 var results = spec.results();
49 var suites = this._getSuitesToRoot( spec.suite );
50 sendMessage( 'testDone', suites.join( ' ' ), spec.description, results.totalCount, results.passedCount, results.failedCount, results.skipped );
51 }
52 };
53
54 jasmine.getEnv().addReporter( new GruntReporter() );