diff --git a/package.json b/package.json index 7a5fbde..2223364 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,8 @@ "grunt-contrib-concat": "~0.1.3", "grunt-contrib-jshint": "~0.7.1", "grunt-mocha": "0.4.10", - "grunt-contrib-connect": "~0.7.1" + "requirejs": "~2.1.11", + "mocha": "~1.18.2", + "chai": "~1.9.1" } } diff --git a/tests/lib/test-utils.js b/tests/lib/test-utils.js index e189c52..4419e2e 100644 --- a/tests/lib/test-utils.js +++ b/tests/lib/test-utils.js @@ -60,7 +60,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; diff --git a/tests/node-runner.js b/tests/node-runner.js new file mode 100644 index 0000000..f478f97 --- /dev/null +++ b/tests/node-runner.js @@ -0,0 +1,82 @@ +var requirejs = require('requirejs'); +//var Mocha = require('mocha'); + +requirejs.config({ + paths: { + "tests": "../tests", + "src": "../src", + "spec": "../tests/spec", + "bugs": "../tests/bugs", + "util": "../tests/lib/test-utils", + "Filer": "../dist/filer" + }, + baseUrl: "./lib", + optimize: "none", + shim: { + // TextEncoder and TextDecoder shims. encoding-indexes must get loaded first, + // and we use a fake one for reduced size, since we only care about utf8. + "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.expect = require('chai').expect; +console.log('here 1'); + + describe("one test", function() { + it('should work', function(done){ + require('assert').ok(true); + done(); + }); + }); + +//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);