While writing unit tests for an Angular project using Karma and Jasmine, I met a weird issue.
When I test only a component using fdescribe
it says SUCCESS
.
But if I replace 'fdescribe' with 'describe' and check all tests work fine, then it throws an error for the above component.
The said component uses Google Maps feature, so I added a mock to karma.config.js
like this.
module.exports = function(config) {
config.set({
basePath: '',
// ... other settings
files: ['src/testing/google-map-mock.js'], <-- added this for google maps
// goes next settings
});
};
After added the mockup, it worked with fdescribe
, but still doesn't work with describe
. So weird. Does anyone have any idea? I think the problem comes from between karma config and jasmine, with fdescribe', the mock file is injected exactly, but with
describe` it's not. I think this is the problem.
Please help me if anyone have any idea for me.
Thank you!
I added a mock to solve google is not defined error.
After adding the mock, the component test works with fdescribe
, but doesn't work with describe
clause.