I am using jest to test an application created
using a js framework(not react). I am not rendering any
components. However I am using jquery extensively.
The project structure:
App
--web
-----__mocks__
-----__tests__
--------app.test.js
-----libs
--------jquery
------------jquery-3.js
Inside app.test.js
var PATH = '../libs/jquery/jquery3.js';
jest.mock(PATH);
var $ = require(PATH);
global.$ = global.jQuery = $;
it('test suite description', () =>{
const $ = require(PATH);
...and so on
})
When I run the test, I get
cannot find module '../libs/jquery/jquery3.js'
I've spent hours researching documentation & blogs and couldn't find a working solution.