webdriverio/wdio-jasmine-framework

View on GitHub
test/hooks.spec.js

Summary

Maintainability
F
2 wks
Test Coverage

File hooks.spec.js has 576 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import path from 'path'
import { EventEmitter } from 'events'

import configQPromises from './fixtures/hooks.using.q.promises'
import configNativePromises from './fixtures/hooks.using.native.promises'
Severity: Major
Found in test/hooks.spec.js - About 1 day to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        describe('executes hooks using 3rd party libs (q library)', () => {
            before(async () => {
                global.browser = new WebdriverIO()
                global.browser.options = {}
                const adapter = new JasmineAdapter(0, configQPromises, specs3, configQPromises.capabilities);
    Severity: Major
    Found in test/hooks.spec.js and 1 other location - About 6 days to fix
    test/hooks.spec.js on lines 280..417

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 1062.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        describe('executes hooks using WDIO commands', () => {
            before(async () => {
                global.browser = new WebdriverIO()
                global.browser.options = {}
                const adapter = new JasmineAdapter(0, configWDIOCommands, specs2, configWDIOCommands.capabilities);
    Severity: Major
    Found in test/hooks.spec.js and 1 other location - About 6 days to fix
    test/hooks.spec.js on lines 419..556

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 1062.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            describe('beforeSuite', () => {
                let beforeSuiteHook
    
                before(() => {
                    beforeSuiteHook = global._wdio.beforeSuite
    Severity: Major
    Found in test/hooks.spec.js and 1 other location - About 1 day to fix
    test/hooks.spec.js on lines 229..250

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 205.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            describe('afterSuite', () => {
                let afterSuiteHook
    
                before(() => {
                    afterSuiteHook = global._wdio.afterSuite
    Severity: Major
    Found in test/hooks.spec.js and 1 other location - About 1 day to fix
    test/hooks.spec.js on lines 77..98

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 205.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        describe('hook exceptions', () => {
            it('should fail test', async () => {
                global.browser = new WebdriverIO()
                global.browser.options = { sync: false }
                const adapter = new JasmineAdapter(0, {}, failureSpec, {})
    Severity: Major
    Found in test/hooks.spec.js and 1 other location - About 5 hrs to fix
    test/tests.spec.js on lines 116..125

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 144.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            describe('beforeHook', () => {
                let beforeHookHook
    
                before(() => {
                    beforeHookHook = global._wdio.beforeHook
    Severity: Major
    Found in test/hooks.spec.js and 1 other location - About 4 hrs to fix
    test/hooks.spec.js on lines 117..132

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 131.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            describe('afterHook', () => {
                let afterHookHook
    
                before(() => {
                    afterHookHook = global._wdio.afterHook
    Severity: Major
    Found in test/hooks.spec.js and 1 other location - About 4 hrs to fix
    test/hooks.spec.js on lines 100..115

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 131.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 8 locations. Consider refactoring.
    Open

            it('should defer execution until custom wdio promise command resolves', () => {
                let duration = global.____wdio.customWdioPromise.end - global.____wdio.customWdioPromise.start
                duration.should.be.greaterThan(990)
            })
    Severity: Major
    Found in test/hooks.spec.js and 7 other locations - About 1 hr to fix
    test/hooks.spec.js on lines 566..569
    test/hooks.spec.js on lines 576..579
    test/hooks.spec.js on lines 581..584
    test/hooks.spec.js on lines 586..589
    test/hooks.spec.js on lines 591..594
    test/hooks.spec.js on lines 596..599
    test/hooks.spec.js on lines 601..604

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 67.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 8 locations. Consider refactoring.
    Open

            it('should defer execution until custom q promise command resolves', () => {
                let duration = global.____wdio.customQPromise.end - global.____wdio.customQPromise.start
                duration.should.be.greaterThan(990)
            })
    Severity: Major
    Found in test/hooks.spec.js and 7 other locations - About 1 hr to fix
    test/hooks.spec.js on lines 566..569
    test/hooks.spec.js on lines 571..574
    test/hooks.spec.js on lines 576..579
    test/hooks.spec.js on lines 586..589
    test/hooks.spec.js on lines 591..594
    test/hooks.spec.js on lines 596..599
    test/hooks.spec.js on lines 601..604

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 67.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 8 locations. Consider refactoring.
    Open

            it('should defer execution until custom command wrapping custom wdio command resolves', () => {
                let duration = global.____wdio.customWrapWdio.end - global.____wdio.customWrapWdio.start
                duration.should.be.greaterThan(990)
            })
    Severity: Major
    Found in test/hooks.spec.js and 7 other locations - About 1 hr to fix
    test/hooks.spec.js on lines 566..569
    test/hooks.spec.js on lines 571..574
    test/hooks.spec.js on lines 576..579
    test/hooks.spec.js on lines 581..584
    test/hooks.spec.js on lines 591..594
    test/hooks.spec.js on lines 596..599
    test/hooks.spec.js on lines 601..604

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 67.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 8 locations. Consider refactoring.
    Open

            it('should defer execution until custom command wrapping two native promise commands resolves', () => {
                let duration = global.____wdio.customWrapTwoPromises.end - global.____wdio.customWrapTwoPromises.start
                duration.should.be.greaterThan(1990)
            })
    Severity: Major
    Found in test/hooks.spec.js and 7 other locations - About 1 hr to fix
    test/hooks.spec.js on lines 566..569
    test/hooks.spec.js on lines 571..574
    test/hooks.spec.js on lines 576..579
    test/hooks.spec.js on lines 581..584
    test/hooks.spec.js on lines 586..589
    test/hooks.spec.js on lines 591..594
    test/hooks.spec.js on lines 601..604

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 67.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 8 locations. Consider refactoring.
    Open

            it('should defer execution until custom command wrapping wdio comamnd treated as promise resolves', () => {
                let duration = global.____wdio.customHandleWdioAsPromise.end - global.____wdio.customHandleWdioAsPromise.start
                duration.should.be.greaterThan(1990)
            })
    Severity: Major
    Found in test/hooks.spec.js and 7 other locations - About 1 hr to fix
    test/hooks.spec.js on lines 566..569
    test/hooks.spec.js on lines 571..574
    test/hooks.spec.js on lines 576..579
    test/hooks.spec.js on lines 581..584
    test/hooks.spec.js on lines 586..589
    test/hooks.spec.js on lines 591..594
    test/hooks.spec.js on lines 596..599

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 67.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 8 locations. Consider refactoring.
    Open

            it('should defer execution until custom native promise command resolves', () => {
                let duration = global.____wdio.customNativePromise.end - global.____wdio.customNativePromise.start
                duration.should.be.greaterThan(990)
            })
    Severity: Major
    Found in test/hooks.spec.js and 7 other locations - About 1 hr to fix
    test/hooks.spec.js on lines 566..569
    test/hooks.spec.js on lines 571..574
    test/hooks.spec.js on lines 581..584
    test/hooks.spec.js on lines 586..589
    test/hooks.spec.js on lines 591..594
    test/hooks.spec.js on lines 596..599
    test/hooks.spec.js on lines 601..604

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 67.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 8 locations. Consider refactoring.
    Open

            it('should defer execution until custom command wrapping custom wdio promise command resolves', () => {
                let duration = global.____wdio.customWrapWdioPromise.end - global.____wdio.customWrapWdioPromise.start
                duration.should.be.greaterThan(990)
            })
    Severity: Major
    Found in test/hooks.spec.js and 7 other locations - About 1 hr to fix
    test/hooks.spec.js on lines 566..569
    test/hooks.spec.js on lines 571..574
    test/hooks.spec.js on lines 576..579
    test/hooks.spec.js on lines 581..584
    test/hooks.spec.js on lines 586..589
    test/hooks.spec.js on lines 596..599
    test/hooks.spec.js on lines 601..604

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 67.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 8 locations. Consider refactoring.
    Open

            it('should defer execution until custom wdio command completes', () => {
                let duration = global.____wdio.customWdio.end - global.____wdio.customWdio.start
                duration.should.be.greaterThan(990)
            })
    Severity: Major
    Found in test/hooks.spec.js and 7 other locations - About 1 hr to fix
    test/hooks.spec.js on lines 571..574
    test/hooks.spec.js on lines 576..579
    test/hooks.spec.js on lines 581..584
    test/hooks.spec.js on lines 586..589
    test/hooks.spec.js on lines 591..594
    test/hooks.spec.js on lines 596..599
    test/hooks.spec.js on lines 601..604

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 67.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status