Stryker

utils.js - Stryker report

File / Directory
Mutation score
# Killed
# Survived
# Timeout
# No coverage
# Runtime errors
# Transpile errors
Total detected
Total undetected
Total mutants
utils.js
96.15 %
96.15 25 1 0 0 0 0 25 1 26
Expand all
/**
 * Mark field as invalid
 * @private
 * @param {Element} field
 * @param {Element} message
 * @param {object} classes
 * @param {string} classes.error
 * @param {string} classes.valid
 * @param {Array.<string>} errors
 */
export function markError(field, message, { error, valid }, errors) 0{
    field.classList.add(error);
    field.classList.remove(valid);

    message.innerHTML = errors.join(1', '); // eslint-disable-line no-param-reassign
}

/**
 * Mark field as valid
 * @private
 * @param {Element} field
 * @param {Element} message
 * @param {object} classes
 * @param {string} classes.error
 * @param {string} classes.valid
 */
export function markValid(field, message, { error, valid }) 2{
    field.classList.add(valid);
    field.classList.remove(error);

    message.innerHTML = 3''; // eslint-disable-line no-param-reassign
}

/**
 * Mark field
 * @private
 * @param {Element} field
 * @param message
 * @param states
 * @param errors
 */
export function markField(field, message, states, errors) 4{
    if (567errors && errors.length) 8{
        markError(field, message, states, errors);
    } else 9{
        markValid(field, message, states);
    }
}

/**
 * Init error messages
 * @private
 * @param {object} rules
 * @param {object} messages
 * @param {object} methods
 * @returns {Object.<string, Object.<string, string>>}
 */
export function initErrorMessages(rules, messages, methods) 10{
    return Object.keys(rules).reduce(
        (names, name) => (11{
            ...names,
            [name]: Object.keys(rules[name]).reduce(
                (ruleNames, method) => (12{
                    ...ruleNames,
                    [method]:
                        131415161718(192021messages[name] && messages[name][method]) ||
                        (222324methods[method] && methods[method].message) ||
                        25'',
                }),
                {},
            ),
        }),
        {},
    );
}
# Mutator State Location Original Replacement
0 Block Killed 10 : 68 { ... } {}
1 StringLiteral Killed 14 : 36 ', ' ""
2 Block Killed 26 : 60 { ... } {}
3 StringLiteral Killed 30 : 24 '' " ... !"
4 Block Killed 41 : 58 { ... } } {}
5 IfStatement Killed 42 : 8 && .
6 IfStatement Killed 42 : 8 && .
7 BinaryExpression Killed 42 : 8 && . || .
8 Block Killed 42 : 33 { ... } {}
9 Block Killed 44 : 11 { ... } {}
10 Block Killed 57 : 60 { ... ); } {}
11 ObjectLiteral Killed 59 : 26 { ... } {}
12 ObjectLiteral Killed 62 : 40 { ... } {}
13 BinaryExpression Killed 65 : 24 ( ... '' ( ...&& ''
14 ConditionalExpression Killed 65 : 24 ( ... ''
15 ConditionalExpression Killed 65 : 24 ( ... ''
16 BinaryExpression Killed 65 : 24 ( ... ) [ ... ].
17 ConditionalExpression Killed 65 : 24 ( ... )
18 ConditionalExpression Killed 65 : 24 ( ... )
19 BinaryExpression Killed 65 : 25 [ ... ] [ ... ]
20 ConditionalExpression Killed 65 : 25 [ ... ]
21 ConditionalExpression Killed 65 : 25 [ ... ]
22 BinaryExpression Killed 66 : 25 [ ... ]. [ ... ].
23 ConditionalExpression Killed 66 : 25 [ ... ].
24 ConditionalExpression Killed 66 : 25 [ ... ].
25 StringLiteral Survived 67 : 24 '' " ... !"