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() {
if(typeof module !== 'undefined' && module.exports) {
return MemoryTestProvider;
}
// When running tests, and when no explicit provider is defined,
// prefer providers in this order: IndexedDB, WebSQL, Memory.
// 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;
}
@ -60,7 +64,7 @@ function(Filer, IndexedDBTestProvider, WebSQLTestProvider, MemoryTestProvider) {
// Create a file system and wait for it to get setup
_provider.init();
console.log('here!');
function complete(err, fs) {
if(err) throw err;
_fs = fs;

View File

@ -1,5 +1,4 @@
var requirejs = require('requirejs');
//var Mocha = require('mocha');
requirejs.config({
paths: {
@ -18,65 +17,24 @@ requirejs.config({
"encoding": {
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
});
GLOBAL.window = GLOBAL;
GLOBAL.document = {};
GLOBAL.navigator = { userAgent: ""};
GLOBAL.window = {
addEventListener: function(){},
navigator: navigator,
document: document,
setTimeout: setTimeout
};
GLOBAL.expect = require('chai').expect;
console.log('here 1');
describe("one test", function() {
it('should work', function(done){
require('assert').ok(true);
done();
});
describe("Mocha needs one test in order to wait on requirejs tests", function() {
it('should wait for other tests', function(){
require('assert').ok(true);
});
//requirejs(function() {
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);
requirejs(["tests/test-manifest"]);