Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

using a console reporter, got regular jasmine to run programmatically.

but not when brining in AMD modules, still need to work on that.
  • Loading branch information...
commit 49e211dcbc8ec3f6f78a8d605e448f20db235503 1 parent 6e56497
@geddski geddski authored
View
13 jasmine/SpecRunner.html
@@ -11,14 +11,17 @@
<script type="text/javascript">
require.config(
- {paths: {
- 'jquery' : 'lib/jquery'
- }}
+ {
+ baseUrl : 'js',
+ paths: {
+ 'jquery' : 'lib/jquery'
+ }
+ }
);
require([
//include all specs to be run
- 'js/spec/ScriptSpec',
- 'js/spec/ModuleSpec'
+ 'spec/ScriptSpec',
+ 'spec/ModuleSpec'
],
function() {
//run tests
View
28 jasmine/js/lib/consoleJasmineReporter2.js
@@ -12,36 +12,36 @@
ConsoleJasmineReporter.prototype.reportRunnerResults = function(runner){
var output = [],
results = runner.results(),
- specs = runner.specs()
- var msg = [specs.length, 'specs,', results.failedCount, 'failures.'].join(' ')
+ specs = runner.specs();
+ var msg = [specs.length, 'specs,', results.failedCount, 'failures.'].join(' ');
if (results.failedCount > 0)
- msg = red(msg)
+ msg = red(msg);
else
- msg = green(msg)
- output.push(msg)
+ msg = green(msg);
+ output.push(msg);
for (var i = 0; i < specs.length; i++) {
- var spec = specs[i]
- var results = spec.results()
+ var spec = specs[i];
+ var results = spec.results();
if (results.failedCount > 0){
- var items = results.getItems()
- var numItems = items.length
+ var items = results.getItems();
+ var numItems = items.length;
for (var j = 0; j < numItems; j++){
var result = items[j]
if (result.type == 'log')
- output.push(' LOG: ' + result.toString())
+ output.push(' LOG: ' + result.toString());
else if (result.type == 'expect' &&
result.passed && !result.passed()){
- output.push(spec.getFullName())
+ output.push(spec.getFullName());
output.push(' ' + red(result.message))
}
}
}
}
console.log(output.join('\n'))
- }
+ };
- window.ConsoleJasmineReporter = ConsoleJasmineReporter
+ exports.ConsoleJasmineReporter = ConsoleJasmineReporter
-}())
+}());
View
11 jasmine/js/runner.js
@@ -7,10 +7,9 @@ requirejs.config({
//bring in and list all the tests to be run
requirejs(['./spec/ModuleSpec'], function(ModuleSpec) {
var jasmine = require('./lib/jasmine-1.1.0.rc1/jasmine').jasmine;
-
-// jasmine.getEnv().addReporter(new jasmine.TrivialReporter());
-// jasmine.getEnv().execute();
-
-// console.log("ModuleSpec: ", ModuleSpec);
-// exports.ModuleTest = ModuleTest;
+ var ConsoleJasmineReporter2 = require('./lib/consoleJasmineReporter2').ConsoleJasmineReporter;
+ // console.log("ModuleSpec: ", ModuleSpec);
+// exports.ModuleSpec = ModuleSpec;
+ jasmine.getEnv().addReporter(new ConsoleJasmineReporter2());
+ jasmine.getEnv().execute();
});
View
11 jasmine/js/spec/ModuleSpec.js
@@ -1,4 +1,9 @@
+//todo find better way to make these globally available
+var jasmine = jasmine || require('../lib/jasmine-1.1.0.rc1/jasmine').jasmine;
var describe = describe || require('../lib/jasmine-1.1.0.rc1/jasmine').describe;
+var it = it || require('../lib/jasmine-1.1.0.rc1/jasmine').it;
+var expect = expect || require('../lib/jasmine-1.1.0.rc1/jasmine').expect;
+
console.log('modulespec');
describe('module test', function() {
@@ -6,7 +11,9 @@ describe('module test', function() {
// if(isNode){
// require = require('requirejs');
// }
- require([], function(){
+
+// require(['SampleModule'], function(SampleModule){
+// console.log("SampleModule: ", SampleModule);
it('should work', function() {
expect(3).toEqual(3);
});
@@ -18,5 +25,5 @@ describe('module test', function() {
it('should work in the browser and node', function() {
expect(1).toEqual(1);
});
- });
+// });
});
Please sign in to comment.
Something went wrong with that request. Please try again.