I'm using Angular-cli and also this library: ng2-datetime.
I have posted a comment pointing out this issue, but wanted to try my luck on SO aswell...
Issue:
When executing the ng-test command, I'm getting the following error message:
Chrome 59.0.3071 (Windows 10 0.0.0) ERROR Uncaught TypeError: Cannot read property 'dates' of undefined at webpack:///~/bootstrap-datepicker/dist/locales/bootstrap-datepicker.es.min.js:1:0 <- src/test.ts:124808
Chrome 59.0.3071 (Windows 10 0.0.0) ERROR Uncaught TypeError: Cannot read property 'dates' of undefined at webpack:///~/bootstrap-datepicker/dist/locales/bootstrap-datepicker.es.min.js:1:0 <- src/test.ts:124808
Highlighted:
Uncaught TypeError: Cannot read property 'dates' of undefined
at webpack:///~/bootstrap-datepicker/dist/locales/bootstrap-datepicker.es.min.js:1:0 <- src/test.ts:124808
I'm actually importing these scripts in the module of the components where is going to be used, like this:
import 'bootstrap-datepicker/dist/css/bootstrap-datepicker3.min.css';
import 'bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js';
import 'bootstrap-datepicker/dist/locales/bootstrap-datepicker.de.min.js';
import 'bootstrap-datepicker/dist/locales/bootstrap-datepicker.es.min.js';
I have tried multiple approaches, like adding to karma.conf.js the jquery script:
files: [
{pattern: './node_modules/jquery/dist/jquery.min.js', watched: true},
{pattern: './src/test.ts', watched: false}
],
I'm really stuck with this one, but I believe it may be a common issue with jQuery based libraries used in Angular.
Thanks for the help, if you need any aditional information just let me know, I'll provide!
I have found the issue for this, it was so simple!
I just needed to add a line to
karma.conf.js:My final
filesarray within this file is like this: