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

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

Open
vort3xxx opened this issue Jun 25, 2018 · 1 comment · May be fixed by #362

Comments

@vort3xxx
Copy link

vort3xxx commented Jun 25, 2018

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
Copy link
Author

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

jinbijin added a commit to jinbijin/eslint-plugin-jasmine that referenced this issue Jan 14, 2023
…evaluated expressions

Corrects rule state in branch mode if a call to `describe` or `it` is encountered with an evaluated expression as first argument. Fixes tlvince#164.
@jinbijin jinbijin linked a pull request Jan 14, 2023 that will close this issue
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants