node.js - Karma Unit Testing -
i'm having trouble trying figure out reason error when trying start karma:
bash-3.2$ node_env=test karma start info [karma]: karma v0.12.31 server started @ http://localhost:9876/ info [launcher]: starting browser phantomjs info [phantomjs 1.9.8 (mac os x)]: connected on socket fontq1onxixrecrxygns id 73511945 phantomjs 1.9.8 (mac os x) error referenceerror: can't find variable: require @ /public/components/angular-cookies/index.js:1
the index.js file contains:
require('./angular-cookies'); module.exports = 'ngcookies';
please help!!
one way fix npm install karma-browserify --save-dev
. should work , have if actual file need uses require.
index.js
not actual file need. angular-cookies.js
is.
i find using browserify makes debugging test errors more difficult because stack trace karma refer line numbers temporary .browserify bundles got deleted time test done.
a simple solution point files
in karma.conf.js
directly angular-cookies.js
instead of using wildcards. way, index.js
, usage of require not cause unnecessary issue.
Comments
Post a Comment