ReferenceError: module is not defined – Karma/Jasmine configuration with Angular/Laravel app

Perhaps this will help someone. The solution, for me, was to make sure angular-mocks.js was loaded before my tests. If you’re not sure, you control the order in karma.conf.js under the following section: // list of files / patterns to load in the browser files: [ // include files / patterns here Next, to get … Read more

Some of your tests did a full page reload – error when running Jasmine tests

In my case the problem was that in my source code I had code directly setting the href on the location object, like window.location.href=”https://stackoverflow.com/questions/29352578/somewhere”; In my specs I set up a onbeforeunload listener that just returns a string instead of allowing the redirect to take place: beforeAll(() => { window.onbeforeunload = () => ‘Oh no!’; … Read more

Error: No provider for “framework:jasmine”! (Resolving: framework:jasmine)

Grunt –force works because you tell it to bypass the karma tests. Notice if you run grunt –force, it’ll still say “Done, but with warnings”. To fix: add “karma-jasmine” and “karma-chrome-launcher” (or whatever launcher you use) to the devDependencies in packages.json and run npm install again. npm install karma-jasmine –save-dev npm install karma-chrome-launcher –save-dev This … Read more

Testing Angular component with unsubscribe Error during cleanup of component

The “Error during component cleanup” error message happens because when ngOnDestroy() is called, this.routeSubscription is undefined. This happens because ngOnInit() was never invoked, meaning that you never subscribed to the route. As described in the Angular testing tutorial, the component isn’t initialized fully until you call fixture.detectChanges() the first time. Therefore, the correct solution is … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)