creevey
Version:
Cross-browser screenshot testing tool for Storybook with fancy UI Runner
69 lines (54 loc) • 1.71 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.noop = noop;
exports.isDefined = isDefined;
exports.isTest = isTest;
exports.isObject = isObject;
exports.isString = isString;
exports.isFunction = isFunction;
exports.isImageError = isImageError;
exports.isProcessMessage = isProcessMessage;
exports.isWorkerMessage = isWorkerMessage;
exports.isTestMessage = isTestMessage;
exports.isWebpackMessage = isWebpackMessage;
exports.isDockerMessage = isDockerMessage;
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-enable @typescript-eslint/no-explicit-any */
function noop() {
/* noop */
}
function isDefined(value) {
return value !== null && value !== undefined;
}
function isTest(x) {
return isDefined(x) && 'id' in x && 'storyId' in x && typeof x.id == 'string' && typeof x.storyId == 'string';
}
function isObject(x) {
return typeof x == 'object' && x != null;
}
function isString(x) {
return typeof x == 'string';
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
function isFunction(x) {
return typeof x == 'function';
}
function isImageError(error) {
return error instanceof Error && 'images' in error;
}
function isProcessMessage(message) {
return isObject(message) && 'scope' in message;
}
function isWorkerMessage(message) {
return isProcessMessage(message) && message.scope == 'worker';
}
function isTestMessage(message) {
return isProcessMessage(message) && message.scope == 'test';
}
function isWebpackMessage(message) {
return isProcessMessage(message) && message.scope == 'webpack';
}
function isDockerMessage(message) {
return isProcessMessage(message) && message.scope == 'docker';
}