Tests running now

This commit is contained in:
David Humphrey (:humph) david.humphrey@senecacollege.ca 2014-05-16 13:18:13 -04:00 committed by Kieran Sedgwick
parent c18660a2ed
commit e041c2d904
2 changed files with 18 additions and 56 deletions

View File

@ -12,10 +12,14 @@ function(Filer, IndexedDBTestProvider, WebSQLTestProvider, MemoryTestProvider) {
} }
function findBestProvider() { function findBestProvider() {
if(typeof module !== 'undefined' && module.exports) {
return MemoryTestProvider;
}
// When running tests, and when no explicit provider is defined, // When running tests, and when no explicit provider is defined,
// prefer providers in this order: IndexedDB, WebSQL, Memory. // prefer providers in this order: IndexedDB, WebSQL, Memory.
// However, if we're running in PhantomJS, use Memory first. // However, if we're running in PhantomJS, use Memory first.
if(navigator.userAgent.indexOf('PhantomJS') > -1) { if(typeof navigator !== 'undefined' && navigator.userAgent.indexOf('PhantomJS') > -1) {
return MemoryTestProvider; return MemoryTestProvider;
} }
@ -60,7 +64,7 @@ function(Filer, IndexedDBTestProvider, WebSQLTestProvider, MemoryTestProvider) {
// Create a file system and wait for it to get setup // Create a file system and wait for it to get setup
_provider.init(); _provider.init();
console.log('here!');
function complete(err, fs) { function complete(err, fs) {
if(err) throw err; if(err) throw err;
_fs = fs; _fs = fs;

View File

@ -1,5 +1,4 @@
var requirejs = require('requirejs'); var requirejs = require('requirejs');
//var Mocha = require('mocha');
requirejs.config({ requirejs.config({
paths: { paths: {
@ -18,65 +17,24 @@ requirejs.config({
"encoding": { "encoding": {
deps: ["encoding-indexes-shim"] deps: ["encoding-indexes-shim"]
} }
//,
// "mocha": {
// init: function() {
// this.mocha = new Mocha();
// this.mocha.setup("bdd").timeout(5000).slow(250);
// this.mocha.setup("bdd");
// GLOBAL.describe = mocha.describe;
// return this.mocha;
// }
// }
}, },
nodeRequire: require nodeRequire: require
}); });
GLOBAL.window = GLOBAL; GLOBAL.document = {};
GLOBAL.navigator = { userAgent: ""};
GLOBAL.window = {
addEventListener: function(){},
navigator: navigator,
document: document,
setTimeout: setTimeout
};
GLOBAL.expect = require('chai').expect; GLOBAL.expect = require('chai').expect;
console.log('here 1');
describe("one test", function() { describe("Mocha needs one test in order to wait on requirejs tests", function() {
it('should work', function(done){ it('should wait for other tests', function(){
require('assert').ok(true); require('assert').ok(true);
done();
}); });
}); });
//requirejs(function() { requirejs(["tests/test-manifest"]);
requirejs(["tests/test-manifest"], function() {
console.log('here 2');
//console.dir(mocha);
describe("two test", function() {
it('should work', function(done){
require('assert').ok(true);
done();
});
});
console.log('here 3');
// mocha.run(function() {
// console.log('running');
// });
console.log('here 4');
/**
mocha.run(function() {
console.log('here 4');
}).on('fail', function(test) {
console.log('fail', test);
}).on('pass', function(test) {
console.log('pass', test);
});
});
**/
});
//setTimeout(function(){}, 3000);