mmanela / chutzpah

Chutzpah is an open source JavaScript test runner which enables you to run unit tests using QUnit, Jasmine, Mocha and TypeScript.
http://mmanela.github.io/chutzpah/
Apache License 2.0
550 stars 142 forks source link

Cannot run JayData with Chutzpah #176

Closed mmanela closed 10 years ago

mmanela commented 10 years ago

christopherp[CodePlex]
I am using: QUnit 1.6.2.0 Chutzpah 2.5.0 Jaydata 1.3.4 JQuery 1.8.3 Visual Studio 2012 Update 4

I've setup a simple test to create and load an indexedDb database with JayData. The test works fine from the test html page I have but not with Chutzpah in the IDE.

One thing to note: When I tell JayData to use the indexedDb provider, it will load another JS file for that provider from a path relative to the one the Jaydata.js file is in. I wonder if the problem I am having is because JayData cannot load that provider file when running with Chutzpah.

When I right click and choose 'Run JS Tests' in the IDE, my test fails with the JayData error 'Provider fallback failed'. Which indicates it cannot load the provider I specified (I think).

I've tried to force Chutzpah to load the JayData indexedDb provider by using /// ltchutzpah_reference... in my tests.js file, but it still did not work.

mmanela commented 10 years ago

christopherp[CodePlex]
I found the problem.

The JayData isSupported() method (line 14270 of jaydata.js) attempts to find the browser's IDBFactory object by examining window.indexedDB, window.webkitIndexedDB, window.mozIndexedDB, and window.msIndexedDB.

The problem is that none of these properties exist in the PhantomJS browser which Chutzpah uses.

I am currently looking at the PhantomJS and QTWebkit sites to see how the browser supports HTML5 IndexedDB.

If I cannot find a fix, I'll just change my unit tests to use the JayData InMemoryProvider. That should work.

mmanela commented 10 years ago

christopherp[CodePlex]
I've updated to Chutzpah 3.0.0 but it still does not work. The attached .ZIP will show this problem event when running with Chutzpah 3.0.0