I am using Angular-CLI (webpack version) for my Angular 2 project and I also need to use jQuery (sadly. In my case, it\'s a dependency of Semantic-UI and I am using it for h
This is because the testing html file, provided by Karma, doesn't include the scripts.bundle.js
file as normally served version does.
The solution is easy; you just include same path to the jquery file into karma.config.js
file in project's root folder. This file is available at the root of the project.
In files
array, add the path with watched
flag like this:
files: [
{ pattern: './node_modules/jquery/dist/jquery.min.js', watched: false },
{ pattern: './src/test.ts', watched: false }
]
Karma now should know about the jQuery dependency.