EB
2018-04-29 10:23:21 UTC
I'm confused how to export jQuery correctly in order to test several
functions with mocha and the assertion library chai. Hopefully this is a
beginner's error...
Here is the code I am testing, with the branch `add_tests`:
https://github.com/mskilab/gGnome.js/tree/add_tests
I'm having trouble with the functions in
https://github.com/mskilab/gGnome.js/blob/master/js/misc.js
with the tests here:
https://github.com/mskilab/gGnome.js/blob/add_tests/test/miscTest.js
So, in order to export jQuery, I include the following line:
https://github.com/mskilab/gGnome.js/blob/add_tests/js/misc.js#L2
const $ = require('jquery');
However, I'm still getting errors when I try to use the functions in
`miscTest.js`, whereby I'm running `mocha` or `npm test`, I get a TypeError:
TypeError: $.ajax is not a function
This is from trying to run
console.log(Misc.metadata);
within `misc.js`
How do I correctly export jQuery so it's recognized?
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/947925b2-69d3-4146-8c88-c561b5d6d925%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
functions with mocha and the assertion library chai. Hopefully this is a
beginner's error...
Here is the code I am testing, with the branch `add_tests`:
https://github.com/mskilab/gGnome.js/tree/add_tests
I'm having trouble with the functions in
https://github.com/mskilab/gGnome.js/blob/master/js/misc.js
with the tests here:
https://github.com/mskilab/gGnome.js/blob/add_tests/test/miscTest.js
So, in order to export jQuery, I include the following line:
https://github.com/mskilab/gGnome.js/blob/add_tests/js/misc.js#L2
const $ = require('jquery');
However, I'm still getting errors when I try to use the functions in
`miscTest.js`, whereby I'm running `mocha` or `npm test`, I get a TypeError:
TypeError: $.ajax is not a function
This is from trying to run
console.log(Misc.metadata);
within `misc.js`
How do I correctly export jQuery so it's recognized?
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/947925b2-69d3-4146-8c88-c561b5d6d925%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.