I am writing unit-test based on Karma and ng-mock.
While I load
import $ from 'jquery';
import _ from 'lodash';
import expect from 'expect.js';
import ngMock from 'ng_mock';
import sinon from 'auto-release-sinon';
import VisProvider from 'ui/vis';
describe('testing my vis', function () {
beforeEach(ngMock.module('kibana','my_plugin'));
//or beforeEach(ngMock.module('kibana','kibana/my_plugin'));
//or beforeEach(ngMock.module('kibana/my_plugin'));
it('should ...');
});
it says:
[$injector:modulerr] Failed to instantiate module my_plugin due to:
Error: [$injector:nomod] Module 'my_plugin' is not available! You either misspelled the module
name or forgot to load it. If registering a module ensure that you specify the dependencies as the
second argument.
I checked there are no spelling mistakes.
My Kibana dev version is 5.4.0.
I am keeping my test files in test folder inside public and running unit test using npm run test:browser.
And package.json reads "test:browser": "plugin-helpers test:browser".
What may be the issue? What am i doing wrong?