Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

while run jasmine test using karma "karma start --single-run" #176

Open
shrutivirani opened this issue Apr 26, 2018 · 0 comments
Open

while run jasmine test using karma "karma start --single-run" #176

shrutivirani opened this issue Apr 26, 2018 · 0 comments

Comments

@shrutivirani
Copy link

i am facing this error while run jasmine test
Error: [$injector:modulerr] Failed to instantiate module undefined due to:
Error: [ng:areq] Argument 'fn' is not a function, got undefined
at bower_components/angular/angular.js:125:12
at bower_components/angular/angular.js:5034:15
at forEach (bower_components/angular/angular.js:418:20)
at loadModules (bower_components/angular/angular.js:4994:5)
at Object.createInjector [as injector] (bower_components/angular/angular.js:4911:19)
at UserContext.WorkFn (bower_components/angular-mocks/angular-mocks.js:3145:52)

controller.js
(function (angular, jQuery) {
'use strict';
var app = angular.module('taxDataEntry', [
'designdynamicscreens',
'taxcharDirective',
'taxdateDirective',
'taxlongDirective',
'taxidDirective',
'taxdoubleDirective',
'taxshortDirective',
'taxlong64Directive',
'taxstrDirective',
'taxglacDirective',
'taxpercentagereferenceDirective',
'dataEntry.tpls',
'dataEntryServices',
'taxDataEntry.config',
'DesignRendererServices']);

app.controller('dataEntryController',
['$cacheFactory', '$scope', 'productDataSvc', '$stateParams', '$state',
 '$rootScope', '$controller', 'GridDataService', 'bentoComboDataService', 'bmJobQueue', '$translate', '$injector',     '$animate', '$q', '$timeout', AssociationService','errorAlertsFactory','dataEntryConfigService', 'bentoComboViewCacheService', function ($cacheFactory, $scope, productDataSvc, $stateParams, $state,

$rootScope, $controller, GridDataService, bentoComboDataService, bmJobQueue, $translate, $injector, $animate, $q, $timeout, AssociationService, errorAlertsFactory, dataEntryConfigService, bentoComboViewCacheService)
{
..............
.............
............
}
}

contoller_test.js
describe('Controller: dataEntryController', function () {
'use strict';

beforeEach(module('ui.bootstrap'));
beforeEach(module('ngCookies'));
beforeEach(module('bento.modern'));
beforeEach(module('pascalprecht.translate'));
beforeEach(module('designdynamicscreens', []));
beforeEach(module('taxcharDirective', []));
beforeEach(module('taxdateDirective', []));
beforeEach(module('taxlongDirective', []));
beforeEach(module('taxidDirective', []));
beforeEach(module('taxdoubleDirective', []));
beforeEach(module('taxshortDirective', []));
beforeEach(module('taxlong64Directive', []));
beforeEach(module('taxstrDirective', []));
beforeEach(module('taxglacDirective', []));
beforeEach(module('taxpercentagereferenceDirective', []));
beforeEach(module('dataEntry.tpls', []));
beforeEach(module('dataEntryServices', []));
beforeEach(module('taxDataEntry.config', []));
beforeEach(module('DesignRendererServices', []));
beforeEach(module('taxDataEntry', ['designdynamicscreens', 'taxcharDirective', 'taxdateDirective', 'taxlongDirective', 'taxidDirective', 'taxdoubleDirective', 'taxshortDirective', 'taxlong64Directive', 'taxstrDirective', 'taxglacDirective', 'taxpercentagereferenceDirective', 'dataEntry.tpls', 'dataEntryServices', 'taxDataEntry.config', 'DesignRendererServices'])

);
var $cacheFactory, $scope, productDataSvc, $stateParams, $state,
$rootScope, $controller, GridDataService, bentoComboDataService, bmJobQueue, $translate, $injector,
$animate, $q, $timeout, AssociationService, errorAlertsFactory, dataEntryConfigService, bentoComboViewCacheService;

beforeEach(inject(function (_$cacheFactory_, _productDataSvc_, _$stateParams_, _$state_,
    _$rootScope_, _$controller_, _GridDataService_, _bentoComboDataService_, _bmJobQueue_, _$translate_, _$injector_,
    _$animate_, _$q_, _$timeout_, _AssociationService_, _errorAlertsFactory_, _dataEntryConfigService_, _bentoComboViewCacheService_) {
    dataEntryConfigService = _dataEntryConfigService_;
    $scope: $rootScope.$new();
    $cacheFactory = $cacheFactory,

        productDataSvc = productDataSvc,
        $stateParams = $stateParams,
        $state = $state,
        $rootScope = $rootScope,
        GridDataService = GridDataService,
        bentoComboDataService = bentoComboDataService,
        bmJobQueue = bmJobQueue,
        $translate = $translate,
        $animate = $animate,
        $q = $q,
        $timeout = $timeout,
        AssociationService = AssociationService,
        errorAlertsFactory = errorAlertsFactory,
       
        bentoComboViewCacheService = bentoComboViewCacheService
    $controller = _$controller_('dataEntryController', {           
    });
}));  

describe("data entry controller", function () {

    it("should be created successfully", function () {
        expect("hello").toBe("hello");
    });
});

});

i have loaded all file into karma config too but it dispaly "fn" error.. please guide something

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant