Skip to content

Add jasmine helpers and run their specs

Luke Bennett requested to merge allow-shared-examples-jasmine into master

What does this MR do?

Adds jasmine helpers, so we can start to store complex stubs and shared examples.


The new ClassSpecHelper is a helper for testing the structure of a class. It currently just has itShouldBeAStaticMethod which will assert that the provided base class and method name refers to a static class method.

For example:

describe('SomeClass', () => {
    describe('.someMethod', () => {
         ClassSpecHelper.itShouldBeAStaticMethod(SomeClass, 'someMethod');

         it('should have some other property to assert', () => { ... });
    });
});

Also see !6764 (merged) and !8412 (merged) for usage.


It also enables teaspoon to run specs for spec/helpers. For example, spec/javascripts/helpers/class_spec_helper.js and have the spec spec/javascripts/helpers/class_spec_helper_spec.js, which should be tested for coverage.

Screen_Shot_2017-01-04_at_18.01.27


The .eslintrc update allows us to have branched dupes, but not block dupes.

For example, we can now do:

describe('SomeClass', () => {

    describe('.someMethod', () => {
        it('returns true', () => { ... });
    });

    describe('.someOtherMethod', () => {
        it('returns true', () => { ... });
    });

});

This wasn't possible before.

You still cant do:

describe('SomeClass', () => {

     it('returns true', () => { ... });

     it('returns true', () => { ... });

});

Are there points in the code the reviewer needs to double check?

Why was this MR needed?

Screenshots (if relevant)

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes #26305 (closed)

Merge request reports

Loading