tlvince / eslint-plugin-jasmine

ESLint rules for Jasmine
https://www.npmjs.com/package/eslint-plugin-jasmine
MIT License
95 stars 58 forks source link

no-spec-dupes branch scoping fails when describe blocks are defined with template literals as the name #164

Open vort3xxx opened 6 years ago

vort3xxx commented 6 years ago

I have a few specs that use template literal strings as the titles. The it blocks beneath seem to get grouped together as one big describe when evaluating duplication, even with the branch scope mode enabled.

My config looks like this:

 "jasmine/expect-matcher": 2,
 "jasmine/missing-expect": 0,
 "jasmine/new-line-between-declarations": 0,
 "jasmine/new-line-before-expect": 0,
 "jasmine/no-spec-dupes": [1, "branch"],
 "jasmine/no-suite-dupes": [1, "branch"],
 "jasmine/prefer-toHaveBeenCalledWith": 0

My describe blocks follow this general shape:

    describe(`${ACTIONS.DATA_LOADING}`, () => {
        it('should set isLoading', () => {
            action = {
                type: ACTIONS.DATA_LOADING
            };
            result = {
                isLoading: true
            };

            Reducer(reducer).withState(state).expect(action).toReturnState(result);
        });
    });

    describe(`${ACTIONS.DATA_SAVING}`, () => {
        it('should set isLoading', () => {
            action = {
                type: ACTIONS.DATA_SAVING
            };
            result = {
                isLoading: true
            };

            Reducer(reducer).withState(state).expect(action).toReturnState(result);
        });
    });

karma/jasmine execute the tests normally and emit the correct spec titles in the output, however the eslint output yields the following warnings:

Duplicate spec: "should set isLoading" jasmine/no-spec-dupes Duplicate spec: "should set isLoading" jasmine/no-spec-dupes

I am using node.js v8.11.1 eslint 3.19.0 eslint-plugin-jasmine 2.10.1

vort3xxx commented 6 years ago

Further investigation seems to indicate that this happens with string constants as well. No template literal necessary. Any sort of evaluation yields this warning.