webdriverio/wdio-mocha-framework

View on GitHub
test/hooks.spec.js

Summary

Maintainability
F
2 wks
Test Coverage

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

import configQPromises from './fixtures/hooks.using.q.promises'
import configNativePromises from './fixtures/hooks.using.native.promises'
import configWDIOCommands from './fixtures/hooks.using.wdio.commands'
import configCustomCommands from './fixtures/hooks.using.custom.commands'
import configAsyncCommands from './fixtures/hooks.using.async.conf'
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('MochaAdapter executes hooks using WDIO commands', () => {
        before(async () => {
            global.browser = new WebdriverIO()
            global.browser.options = {}
            const adapter = new MochaAdapter(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 410..547

    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('MochaAdapter executes hooks using 3rd party libs (q library)', () => {
        before(async () => {
            global.browser = new WebdriverIO()
            global.browser.options = {}
            const adapter = new MochaAdapter(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 271..408

    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('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 65..86

    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('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 220..241

    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('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 88..103

    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('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 105..120

    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 557..560
    test/hooks.spec.js on lines 567..570
    test/hooks.spec.js on lines 572..575
    test/hooks.spec.js on lines 577..580
    test/hooks.spec.js on lines 582..585
    test/hooks.spec.js on lines 587..590
    test/hooks.spec.js on lines 592..595

    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 557..560
    test/hooks.spec.js on lines 562..565
    test/hooks.spec.js on lines 572..575
    test/hooks.spec.js on lines 577..580
    test/hooks.spec.js on lines 582..585
    test/hooks.spec.js on lines 587..590
    test/hooks.spec.js on lines 592..595

    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 557..560
    test/hooks.spec.js on lines 562..565
    test/hooks.spec.js on lines 567..570
    test/hooks.spec.js on lines 577..580
    test/hooks.spec.js on lines 582..585
    test/hooks.spec.js on lines 587..590
    test/hooks.spec.js on lines 592..595

    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 562..565
    test/hooks.spec.js on lines 567..570
    test/hooks.spec.js on lines 572..575
    test/hooks.spec.js on lines 577..580
    test/hooks.spec.js on lines 582..585
    test/hooks.spec.js on lines 587..590
    test/hooks.spec.js on lines 592..595

    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 557..560
    test/hooks.spec.js on lines 562..565
    test/hooks.spec.js on lines 567..570
    test/hooks.spec.js on lines 572..575
    test/hooks.spec.js on lines 582..585
    test/hooks.spec.js on lines 587..590
    test/hooks.spec.js on lines 592..595

    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 557..560
    test/hooks.spec.js on lines 562..565
    test/hooks.spec.js on lines 567..570
    test/hooks.spec.js on lines 572..575
    test/hooks.spec.js on lines 577..580
    test/hooks.spec.js on lines 582..585
    test/hooks.spec.js on lines 587..590

    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 557..560
    test/hooks.spec.js on lines 562..565
    test/hooks.spec.js on lines 567..570
    test/hooks.spec.js on lines 572..575
    test/hooks.spec.js on lines 577..580
    test/hooks.spec.js on lines 587..590
    test/hooks.spec.js on lines 592..595

    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 557..560
    test/hooks.spec.js on lines 562..565
    test/hooks.spec.js on lines 567..570
    test/hooks.spec.js on lines 572..575
    test/hooks.spec.js on lines 577..580
    test/hooks.spec.js on lines 582..585
    test/hooks.spec.js on lines 592..595

    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