console_error.js

import isJestTest from '../data/is-jest-test';

/**
 * @module consoleError
 * @description Logs console errors if console is available, and we aren't running Jest.
 *
 * @since 1.0.0
 *
 * @param {string} message The message to log as an error.
 *
 * @requires isJestTest
 *
 * @return {void}
 *
 * @example
 * import { consoleError } from "@gravityforms/utils";
 *
 * function Example() {
 *     consoleError( 'Error from example' );
 * }
 *
 */
export default function consoleError( message = '' ) {
	if ( window.console && ! isJestTest() ) {
		console.error( message );
	}
}