Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Jasmine 2.1 beforeAll/afterAll methods cause errors #10238

Closed
@chesleybrown

Description

@chesleybrown

Jasmine has released beforeAll and afterAll methods with 2.1 which allow executing a before function only once for all the following specs. Angular mocks doesn't seem to play nice with this concept.

When using beforeAll or afterAll methods, I encounter the following errors.

TypeError: 'null' is not an object (evaluating 'currentSpec.$modules')
        at workFn (/Users/chesleybrown/Sites/bln-web/app/components/angular-mocks/angular-mocks.js:2323)
        at /Users/chesleybrown/Sites/bln-web/node_modules/karma-jasmine/lib/boot.js:71
        at /Users/chesleybrown/Sites/bln-web/node_modules/karma-jasmine/lib/adapter.js:174
        at http://localhost:9876/karma.js:185
        at http://localhost:9876/context.html:168
    TypeError: 'null' is not an object (evaluating 'currentSpec.$modules')
        at workFn (/Users/chesleybrown/Sites/bln-web/app/components/angular-mocks/angular-mocks.js:2323)
        at /Users/chesleybrown/Sites/bln-web/node_modules/karma-jasmine/lib/boot.js:71
        at /Users/chesleybrown/Sites/bln-web/node_modules/karma-jasmine/lib/adapter.js:174
        at http://localhost:9876/karma.js:185
        at http://localhost:9876/context.html:168
    Expected { 0: HTMLNode, length: 1, prevObject: { 0: HTMLNode, length: 1 }, context: undefined, selector: '.loading-indicator' } to have class 'ng-hide'.
    Error: Expected { 0: HTMLNode, length: 1, prevObject: { 0: HTMLNode, length: 1 }, context: undefined, selector: '.loading-indicator' } to have class 'ng-hide'.
        at /Users/chesleybrown/Sites/bln-web/test/directives/about-product.directive.spec.js:40
        at /Users/chesleybrown/Sites/bln-web/node_modules/karma-jasmine/lib/boot.js:71
        at /Users/chesleybrown/Sites/bln-web/node_modules/karma-jasmine/lib/adapter.js:174
        at http://localhost:9876/karma.js:185
        at http://localhost:9876/context.html:168

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions