eslint-plugin-jasmine icon indicating copy to clipboard operation
eslint-plugin-jasmine copied to clipboard

tomastrajan/jasmine-async-sugar support

Open eburi opened this issue 8 years ago • 2 comments

Do you want to request a feature or report a bug? feature-request - or point me to where I could add it/configure it.

What is the current behavior? I'm using Jasmine-Async-Sugar: https://github.com/tomastrajan/jasmine-async-sugar

Now jasmine/no-unsafe-spy reports a warning, when I use jasmine.createSpy in an itAsync-Block.

What is the expected behavior?

I would like to add the itAsync-Block as a safe place to create Spys. Maybe this is configurable? Maybe it should be added in the code? Please tell me how to do it or how you would like it to be fixed.

Please mention your node.js, eslint-plugin-jasmine and operating system version. node v6.4.0 "eslint-plugin-jasmine": "^1.8.1" Windows 10

eburi avatar Dec 07 '16 14:12 eburi

@eburi could you post a code snippet that has the problem?

burabure avatar Dec 07 '16 15:12 burabure

Here's an example that will currently yield a warning.

itAsync('should not load the item from delegate', function () {
    var loadFromBackendMock = jasmine.createSpy('loadFromBackendMock').and.returnValue($q.when());
    var cachingStrategy = SimpleCacheStrategyFactory.create(CacheIndexDbService.getResolverFor('store'), loadFromBackendMock);

    return cachingStrategy.getItem('A key').then(function () {
        expect(loadFromBackendMock).not.toHaveBeenCalled();
    });
});

warning Spy declared outside of before/after/it block jasmine/no-unsafe-spy

eburi avatar Dec 13 '16 10:12 eburi