ReferenceError: $ is not defined
How can i use AVA with jQuery ?
In my case, i want to test a function which is in a file called app.ts (typescript file)
and i use $.ajax (jQuery API) in that function,
so AVA will want to ask me : what is the $ meaning ?????
Note that, i want to keep unit test simple, clear,
i use jQuery, but it is not meaning i also want to test DOM
NOW i just want to let jQuery work in AVA
How can do that ?
We don't have direct browser support yet.
There is a recipe for mocking the DOM here. Some preliminary work on a browser solution via karma (https://github.com/avajs/ava/pull/942), and work on a full standalone browser test runner (https://github.com/avajs/ava/pull/887).
How to access window in test file ?
Hi, @jamestalmage , thanks reply
I read article for mocking the DOM which u present
but i have no idea how can i access window object in my AVA test file ?
In Node, jQuery need window to initalize
like this var $ = jQuery = require('jquery')(window);
AVA must know $,
because it really execute that code,
that meaning, i must declare $ in test file,
then run all test
ok, i solve it, i decide to use javascript instead of typescript, it seems there is no need to use typescript in AVA now, because i find the way to load typescript module directly in javascript
anyway, @jamestalmage thanks again