File selftest.js
has 494 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { inspect } from 'util';
import * as files from '../fs/files';
import { createHash } from 'crypto';
import {
markBottom as parseStackMarkBottom,
Function saveJUnitOutput
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
saveJUnitOutput(path) {
const grouped = groupTestsByFile(this.filteredTests);
// We'll form an collection of "testsuites"
const testSuites = [];
Function getFilteredTests
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getFilteredTests(options) {
options = options || {};
let allTests = getAllTests();
let testState;
Function runTests
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function runTests(options) {
const testList = getFilteredTests(options);
if (! testList.allTests.length) {
Console.error("No tests defined.");
Function getFilteredTests
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function getFilteredTests(options) {
options = options || {};
let allTests = getAllTests();
let testState;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function constructor
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(allTests, tagsToSkip, tagsToMatch, testState) {
tagsToSkip = (tagsToSkip || []);
testState = (testState || null); // optional
this.allTests = allTests;
this.failedTests = [];
Function runTests
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function runTests(options) {
const testList = getFilteredTests(options);
if (! testList.allTests.length) {
Console.error("No tests defined.");
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function constructor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
constructor(allTests, tagsToSkip, tagsToMatch, testState) {
tagsToSkip = (tagsToSkip || []);
testState = (testState || null); // optional
this.allTests = allTests;
this.failedTests = [];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this function. Open
return false;
Function shouldSkipCurrentTest
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const shouldSkipCurrentTest = ({currentTestIndex, options: {skip, limit} = {}}) => {
if (!skip && !limit) {
return false;
}
if (limit && skip) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"