const { format } = require ( "util" ) ; module see https ignore const emitWarning = ( msg , type ? ) => { if ( process . emitWarning ) { process . emitWarning ( msg , type ) ; } else { process . nextTick ( function ( ) { console . warn ( type + ": " + msg ) ; } ) ; } } ; param { string } msg const deprecate = ( msg ) => { msg = String ( msg ) ; if ( msg && ! deprecate . cache [ msg ] ) { deprecate . cache [ msg ] = true ; emitWarning ( msg , "DeprecationWarning" ) ; } } ; deprecate . cache = { } ; param { string } msg const warn = ( msg ) => { if ( msg ) { emitWarning ( msg ) ; } } ; public namespace memberof const constants = { constant default FATAL : "ERR_MOCHA_FATAL" , constant default INVALID_ARG_TYPE : "ERR_MOCHA_INVALID_ARG_TYPE" , constant default INVALID_ARG_VALUE : "ERR_MOCHA_INVALID_ARG_VALUE" , constant default INVALID_EXCEPTION : "ERR_MOCHA_INVALID_EXCEPTION" , constant default INVALID_INTERFACE : "ERR_MOCHA_INVALID_INTERFACE" , constant default INVALID_REPORTER : "ERR_MOCHA_INVALID_REPORTER" , constant default MULTIPLE_DONE : "ERR_MOCHA_MULTIPLE_DONE" , constant default NO_FILES_MATCH_PATTERN : "ERR_MOCHA_NO_FILES_MATCH_PATTERN" , constant default UNSUPPORTED : "ERR_MOCHA_UNSUPPORTED" , constant default INSTANCE_ALREADY_RUNNING : "ERR_MOCHA_INSTANCE_ALREADY_RUNNING" , constant default INSTANCE_ALREADY_DISPOSED : "ERR_MOCHA_INSTANCE_ALREADY_DISPOSED" , constant default FORBIDDEN_EXCLUSIVITY : "ERR_MOCHA_FORBIDDEN_EXCLUSIVITY" , constant default INVALID_PLUGIN_IMPLEMENTATION : "ERR_MOCHA_INVALID_PLUGIN_IMPLEMENTATION" , constant default INVALID_PLUGIN_DEFINITION : "ERR_MOCHA_INVALID_PLUGIN_DEFINITION" , constant default TIMEOUT : "ERR_MOCHA_TIMEOUT" , constant default UNPARSABLE_FILE : "ERR_MOCHA_UNPARSABLE_FILE" , } ; /**
 * A set containing all string values of all Mocha error constants, for use by  isMochaError .
 *  private const MOCHA_ERRORS = new Set ( Object . values ( constants ) ) ; class MochaError extends Error { code : string ; pattern : string ; constructor ( message ) { super ( message ) ; } } class MochaTypeError extends TypeError { constructor ( message ) { super ( message ) ; } code : string ; reporter : any ; } public static param { string } message param { string } pattern returns { Error } function createNoFilesMatchPatternError ( message , pattern ) { const error = new MochaError ( message ) ; error . code = constants . NO_FILES_MATCH_PATTERN ; error . pattern = pattern ; return error ; } public param { string } message param { string } reporter returns { Error } function createInvalidReporterError ( message , reporter ) { const error = new MochaTypeError ( message ) ; error . code = constants . INVALID_REPORTER ; error . reporter = reporter ; return error ; } class InvalidInterfaceError extends Error { constructor ( message ) { super ( message ) ; } code : string ; interface : any ; } public static param { string } message param { string } ui returns { Error } function createInvalidInterfaceError ( message , ui ) { const error = new InvalidInterfaceError ( message ) ; error . code = constants . INVALID_INTERFACE ; error . interface = ui ; return error ; } class UnsupportedError extends Error { constructor ( message ) { super ( message ) ; } code : string ; } public static param { string } message returns { Error } function createUnsupportedError ( message ) { const error = new UnsupportedError ( message ) ; error . code = constants . UNSUPPORTED ; return error ; } public static param { string } message param { string } argument param { string } expected returns { Error } function createMissingArgumentError ( message , argument , expected ) { return createInvalidArgumentTypeError ( message , argument , expected ) ; } class InvalidArgTypeError extends TypeError { constructor ( message ) { super ( message ) ; } code : string ; argument : any ; expected : any ; actual : any ; } public static param { string } message param { string } argument param { string } expected returns { Error } function createInvalidArgumentTypeError ( message , argument , expected ) { const error = new InvalidArgTypeError ( message ) ; error . code = constants . INVALID_ARG_TYPE ; error . argument = argument ; error . expected = expected ; error . actual = typeof argument ; return error ; } class InvalidArgValueError extends TypeError { constructor ( message ) { super ( message ) ; } code : string ; argument : any ; value : any ; reason : any ; } public static param { string } message param { string } argument param { string } value param { string } reason returns { Error } function createInvalidArgumentValueError ( message , argument , value , reason ) { const error = new InvalidArgValueError ( message ) ; error . code = constants . INVALID_ARG_VALUE ; error . argument = argument ; error . value = value ; error . reason = typeof reason !== "undefined" ? reason : "is invalid" ; return error ; } class InvalidExceptionError extends Error { constructor ( message ) { super ( message ) ; } code : string ; valueType : any ; value : any ; } public static param { string } message returns { Error } function createInvalidExceptionError ( message , value ) { const error = new InvalidExceptionError ( message ) ; error . code = constants . INVALID_EXCEPTION ; error . valueType = typeof value ; error . value = value ; return error ; } class FatalError extends Error { constructor ( message ) { super ( message ) ; } code : string ; valueType : any ; value : any ; } public static param { string } message returns { Error } function createFatalError ( message , value ) { const error = new FatalError ( message ) ; error . code = constants . FATAL ; error . valueType = typeof value ; error . value = value ; return error ; } param { string } message param { "reporter" | "ui" } pluginType param { string } pluginId throws public static returns { Error } function createInvalidLegacyPluginError ( message , pluginType , pluginId ) { switch ( pluginType ) { case "reporter" : return createInvalidReporterError ( message , pluginId ) ; case "ui" : return createInvalidInterfaceError ( message , pluginId ) ; default : throw new Error ( 'unknown pluginType "' + pluginType + '"' ) ; } } class InstanceAlreadyDisposedError extends Error { constructor ( message ) { super ( message ) ; } code : string ; cleanReferencesAfterRun : any ; instance : any ; } param { string } message param { boolean } cleanReferencesAfterRun param { Mocha } instance static function createMochaInstanceAlreadyDisposedError ( message , cleanReferencesAfterRun , instance ) { const error = new InstanceAlreadyDisposedError ( message ) ; error . code = constants . INSTANCE_ALREADY_DISPOSED ; error . cleanReferencesAfterRun = cleanReferencesAfterRun ; error . instance = instance ; return error ; } class InstanceAlreadyRunningError extends Error { constructor ( message ) { super ( message ) ; } code : string ; instance : any ; } param { string } message static public function createMochaInstanceAlreadyRunningError ( message , instance ? ) { const error = new InstanceAlreadyRunningError ( message ) ; error . code = constants . INSTANCE_ALREADY_RUNNING ; error . instance = instance ; return error ; } class MultipleDoneError extends Error { constructor ( message ) { super ( message ) ; } code : string ; valueType : any ; value : any ; } public param { Runnable } runnable param { Error } originalErr returns { Error } static function createMultipleDoneError ( runnable , originalErr ) { var title ; try { title = format ( "<%s>" , runnable . fullTitle ( ) ) ; if ( runnable . parent . root ) { title += " (of root suite)" ; } } catch ( ignored ) { title = format ( "<%s> (of unknown suite)" , runnable . title ) ; } var message = format ( "done() called multiple times in %s %s" , runnable . type ? runnable . type : "unknown runnable" , title ) ; if ( runnable . file ) { message += format ( " of file %s" , runnable . file ) ; } if ( originalErr ) { message += format ( "; in addition, done() received error: %s" , originalErr ) ; } const error = new MultipleDoneError ( message ) ; error . code = constants . MULTIPLE_DONE ; error . valueType = typeof originalErr ; error . value = originalErr ; return error ; } class ForbiddenExclusivityError extends Error { constructor ( message ) { super ( message ) ; } code : string ; } static public param { Mocha } mocha returns { Error } Error with code  constants . FORBIDDEN_EXCLUSIVITY function createForbiddenExclusivityError ( mocha ) { const error = new ForbiddenExclusivityError ( mocha . isWorker ? "`.only` is not supported in parallel mode" : "`.only` forbidden by --forbid-only" ) ; error . code = constants . FORBIDDEN_EXCLUSIVITY ; return error ; } class TimeoutError extends Error { constructor ( message ) { super ( message ) ; } code : string ; timeout : any ; file : any ; } static param { string } msg param { number } timeout param { string } file returns { MochaTimeoutError } function createTimeoutError ( msg , timeout , file ) { const error = new TimeoutError ( msg ) ; error . code = constants . TIMEOUT ; error . timeout = timeout ; error . file = file ; return error ; } class UnparsableFileError extends Error { constructor ( message ) { super ( message ) ; } code : string ; } public static param { string } message param { string } filename returns { Error } Error with code  constants . UNPARSABLE_FILE function createUnparsableFileError ( message , filename ) { const error = new UnparsableFileError ( message ) ; error . code = constants . UNPARSABLE_FILE ; return error ; } static public param { * } error returns { boolean } const isMochaError = ( error ) => Boolean ( error && typeof error === "object" && MOCHA_ERRORS . has ( error . code ) ) ; export { constants , createFatalError , createForbiddenExclusivityError , createInvalidArgumentTypeError , createInvalidArgumentValueError , createInvalidExceptionError , createInvalidInterfaceError , createInvalidLegacyPluginError , createInvalidReporterError , createMissingArgumentError , createMochaInstanceAlreadyDisposedError , createMochaInstanceAlreadyRunningError , createMultipleDoneError , createNoFilesMatchPatternError , createTimeoutError , createUnparsableFileError , createUnsupportedError , deprecate , isMochaError , warn , } ;