2015-07-17 4 views
0

J'ai des tests unitaires fonctionnant sous Karma, et j'utilise la bibliothèque sinon-chai.karma-sinon-chai échoue après avoir migré vers Windows

Tout fonctionnait très bien sur Mac, mais maintenant je l'ai déplacé vers Windows l'erreur suivante est INTERVENUES:

C:\Users\mchambe4\dev\simple\client>node ./node_modules/gulp/bin/gulp.js unit-tests-dev 
[16:29:31] Using gulpfile ~\dev\simple\client\gulpfile.js 
[16:29:31] Starting 'unit-tests-dev'... 
[16:29:31] Starting Karma server... 
WARN [karma]: Port 9876 in use 
INFO [karma]: Karma v0.12.37 server started at http://localhost:9877/ 
INFO [launcher]: Starting browser PhantomJS 
INFO [PhantomJS 1.9.8 (Windows 7 0.0.0)]: Connected on socket fMujwCqRPdmidI3BtCYV with id 16821903 
PhantomJS 1.9.8 (Windows 7 0.0.0) ERROR 
    ReferenceError: Can't find variable: chai 
    at C:/Users/mchambe4/dev/simple/client/node_modules/karma-sinon-chai/node_modules/sinon-chai/lib/sinon-chai.js:17 

De that file:

if (typeof require === "function" && typeof exports === "object" && typeof module === "object") { 
    // NodeJS 
    module.exports = sinonChai; // <---- should go in here 
} else if (typeof define === "function" && define.amd) { 
    // AMD 
    define(function() { 
     return sinonChai; 
    }); 
} else { 
    // Other environment (usually <script> tag): plug in to global chai instance directly. 
    chai.use(sinonChai);   // <---- actually ends up here 
} 

j'attendre la condition sur la première ligne pour retourner true parce que je suis en cours d'exécution dans le nœud, mais pour une raison quelconque, ni 'require', ni module ne sont définis, donc cela finit au point indiqué ci-dessus.

Des idées?

Répondre