From 4b092a1415d14c566b3bbc8217386b3a36d4fc7c Mon Sep 17 00:00:00 2001 From: "David Humphrey (:humph) david.humphrey@senecacollege.ca" Date: Fri, 16 May 2014 12:37:34 -0400 Subject: [PATCH] Initial work on getting tests to run, some working --- package.json | 4 +- tests/lib/test-utils.js | 2 +- tests/node-runner.js | 82 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 tests/node-runner.js 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);