JEStaubach/fs-helpers

View on GitHub
__tests__/fsHelpers.spec.ts

Summary

Maintainability
F
2 wks
Test Coverage

File fsHelpers.spec.ts has 475 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import fsh from '../src/index';
import path from 'path';
import { beforeEach, afterEach, describe, it, expect, vi } from 'vitest';

// create all test directories and files inside one root directory for easy cleanup
Severity: Minor
Found in __tests__/fsHelpers.spec.ts - About 7 hrs to fix

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

          it(`successfully copies a src directory to dest directory`, () => {
            // Create a temporary src directory
            let res = fsHelpers.createDir(pathResolver(`${rootTestDir}/srcDir`));
            expect(res.success).toBe(true);
            expect(res.value).toBe(fsHelpers.getAbsolutePath(`${rootTestDir}`).value);
    Severity: Major
    Found in __tests__/fsHelpers.spec.ts and 1 other location - About 3 days to fix
    __tests__/fsHelpers.spec.ts on lines 481..515

    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 636.

    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

          it(`successfully copies a src directory to dest directory`, () => {
            // Create a temporary src directory
            let res = fsHelpers.createDir(pathResolver(`${rootTestDir}/srcDir`));
            expect(res.success).toBe(true);
            expect(res.value).toBe(fsHelpers.getAbsolutePath(`${rootTestDir}`).value);
    Severity: Major
    Found in __tests__/fsHelpers.spec.ts and 1 other location - About 3 days to fix
    __tests__/fsHelpers.spec.ts on lines 517..551

    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 636.

    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

          it(`successfully renames the src dir to the dest dir - fixed bug when dest dir contains src dir`, () => {
            // create the src directory
            let res = fsHelpers.createDir(pathResolver(`${rootTestDir}/firstName`));
            expect(res.success).toBe(true);
            expect(res.value).toBe(fsHelpers.getAbsolutePath(`${rootTestDir}`).value);
    Severity: Major
    Found in __tests__/fsHelpers.spec.ts and 1 other location - About 3 days to fix
    __tests__/fsHelpers.spec.ts on lines 371..402

    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 590.

    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

          it(`successfully renames the src dir to the dest dir`, () => {
            // create the src directory
            let res = fsHelpers.createDir(pathResolver(`${rootTestDir}/firstName`));
            expect(res.success).toBe(true);
            expect(res.value).toBe(fsHelpers.getAbsolutePath(`${rootTestDir}`).value);
    Severity: Major
    Found in __tests__/fsHelpers.spec.ts and 1 other location - About 3 days to fix
    __tests__/fsHelpers.spec.ts on lines 404..435

    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 590.

    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 4 locations. Consider refactoring.
    Open

          it(`sucessfully returns true when checking existence of parent dir`, () => {
            // Check Dir Existence (should exist - created when seeding file when mocked)
            let res = fsHelpers.checkIfDirExists(pathResolver(`src`));
            expect(res.success).toBe(true);
            expect(res.value).toBe(true);
    Severity: Major
    Found in __tests__/fsHelpers.spec.ts and 3 other locations - About 3 hrs to fix
    __tests__/fsHelpers.spec.ts on lines 34..40
    __tests__/fsHelpers.spec.ts on lines 97..103
    __tests__/fsHelpers.spec.ts on lines 118..124

    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 101.

    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 4 locations. Consider refactoring.
    Open

          it(`sucessfully returns true when checking existence of a seeded file`, () => {
            // Check File Existence (should exist - seeded when mocked)
            let res = fsHelpers.checkIfFileExists(pathResolver(`src/types.ts`));
            expect(res.success).toBe(true);
            expect(res.value).toBe(true);
    Severity: Major
    Found in __tests__/fsHelpers.spec.ts and 3 other locations - About 3 hrs to fix
    __tests__/fsHelpers.spec.ts on lines 42..48
    __tests__/fsHelpers.spec.ts on lines 97..103
    __tests__/fsHelpers.spec.ts on lines 118..124

    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 101.

    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 4 locations. Consider refactoring.
    Open

          it(`successfully returns false if directory doesn't exist`, () => {
            // this directory is assumed not to exist
            let res = fsHelpers.checkIfDirExists(pathResolver(`./SoMeThInG/uNuSuAl`));
            expect(res.success).toBe(true);
            expect(res.value).toBe(false);
    Severity: Major
    Found in __tests__/fsHelpers.spec.ts and 3 other locations - About 3 hrs to fix
    __tests__/fsHelpers.spec.ts on lines 34..40
    __tests__/fsHelpers.spec.ts on lines 42..48
    __tests__/fsHelpers.spec.ts on lines 97..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 101.

    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 4 locations. Consider refactoring.
    Open

          it(`successfully returns true if directory exists, current working directory`, () => {
            // check if cwd exists (it should)
            let res = fsHelpers.checkIfDirExists(pathResolver(`.`));
            expect(res.success).toBe(true);
            expect(res.value).toBe(true);
    Severity: Major
    Found in __tests__/fsHelpers.spec.ts and 3 other locations - About 3 hrs to fix
    __tests__/fsHelpers.spec.ts on lines 34..40
    __tests__/fsHelpers.spec.ts on lines 42..48
    __tests__/fsHelpers.spec.ts on lines 118..124

    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 101.

    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