@stryker-mutator/core
Version:
The extendable JavaScript mutation testing framework
54 lines • 1.32 kB
JavaScript
import { propertyPath } from '@stryker-mutator/util';
import emojiRegex from 'emoji-regex';
const emojiRe = emojiRegex();
export function padLeft(input) {
return input
.split('\n')
.map((str) => '\t' + str)
.join('\n');
}
export function plural(items) {
if (items > 1) {
return 's';
}
else {
return '';
}
}
export function serialize(thing) {
return JSON.stringify(thing);
}
export function deserialize(stringified) {
return JSON.parse(stringified);
}
export function getEmojiForStatus(status) {
switch (status) {
case 'Killed':
return '✅';
case 'NoCoverage':
return '🙈';
case 'Ignored':
return '🤥';
case 'Survived':
return '👽';
case 'Timeout':
return '⏰';
case 'Pending':
return '⌛';
case 'RuntimeError':
case 'CompileError':
return '💥';
}
}
export function stringWidth(input) {
let { length } = input;
for (const match of input.matchAll(emojiRe)) {
length = length - match[0].length + 2;
}
return length;
}
/**
* Print the name of (or path to) a stryker option
*/
export const optionsPath = propertyPath();
//# sourceMappingURL=string-utils.js.map