javascript - doh of dojo is not working with sinon -
i have tried this solution, not works well.
here example code link above:
require([ "doh/runner", "http://sinonjs.org/releases/sinon-1.17.5.js" ], function(doh){ console.log(sinon); });
error message:
$ node ../../dojo/dojo.js load=doh test=tests/test_sinon_spy.js error: enoent: no such file or directory, open 'http://sinonjs.org/releases/sinon-1.17.5.js'
besides this, try require sinon.js directly.
sinon-1.17.5.js
have been moved directory doh
same runner.js
, , renamed sinon
. (the directory )
require([ "doh/runner", "doh/sinon" ], function(doh, sinon){ console.log(sinon); });
there no error message, sinon undefined:
$ node ../../dojo/dojo.js load=doh test=tests/test_sinon_spy.js undefined 0 'tests run in' 0 'groups' ------------------------------------------------------------ | test summary: ------------------------------------------------------------ 0 tests in 0 groups 0 errors 0 failures
i pretty sure second code loads sinon well. verified modifying sinon.js
directly. have no idea why sinon not able call.
version
node.js - v6.2.2 dojo/doh - 1.10.0 sinon - 1.17.5
[updated]
because both node.js
, dojo
have require api, different. case not working because should use node.js's api require sinon.js
rather dojo's api.
dojo provide dojo/node module, call node.js module directly.
1. install sinon npm under same directory of dojo
$ cd ../../dojo $ npm install sinon
2. modify code use dojo/node
# test_sinon_spy.js require([ "doh/runner", "dojo/node!sinon" ], function(doh, sinon){ console.log(sinon); })
3. original folder , run test
$ cd - $ node ../../dojo/dojo.js load=doh test=tests/test_sinon_spy.js
note, under dojo directory, contain npm_module/sinon
Comments
Post a Comment