allure-mocha 3.0.7 → 3.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -62,7 +62,7 @@ var instantiateReporters = (runner, options, entries) => {
|
|
|
62
62
|
var optionsForReporter = _objectSpread(_objectSpread({}, options), {}, {
|
|
63
63
|
reporterOptions,
|
|
64
64
|
// eslint-disable-next-line quote-props
|
|
65
|
-
reporterOption: reporterOptions,
|
|
65
|
+
"reporterOption": reporterOptions,
|
|
66
66
|
"reporter-option": reporterOptions
|
|
67
67
|
});
|
|
68
68
|
reporters.push(new Reporter(runner, optionsForReporter));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extraReporters.js","names":["Mocha","_interopRequireWildcard","require","_nodeModule","_nodePath","_interopRequireDefault","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","localRequire","createRequire","pathToFileURL","__filename","toString","enableExtraReporters","runner","options","extraReportersConfig","extraReporterEntries","Array","from","generateCanonicalizedReporterEntries","loadedReporterEntries","loadReporters","instantiateReporters","exports","doneAll","reporters","failures","fn","doneCallbacks","collectDoneCallbacks","callbacksToWait","onReporterIsDone","done","isReporterArrayEntry","resolveReporterArrayEntry","map","resolveReporterEntry","reporterEntries","_ref","moduleOrCtor","loadReporterModule","entries","Reporter","reporterOptions","optionsForReporter","reporterOption","reporter","bind","maybeReporterModuleOrCtor","maybeReporterOptions","builtInReporters","builtInReporterCtor","reporterModulePath","getReporterModulePath","Error","concat","message","module","resolve","path","reporterEntry"],"sources":["../../src/extraReporters.ts"],"sourcesContent":["import * as Mocha from \"mocha\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport type { ReporterDoneFn, ReporterEntry, ReporterModuleOrCtor, ReporterOptions } from \"./types.js\";\n\ntype CanonicalReporterEntry = readonly [ReporterModuleOrCtor, ReporterOptions];\ntype ShortReporterEntry = readonly [ReporterModuleOrCtor];\ntype LoadedReporterEntry = readonly [Mocha.ReporterConstructor, ReporterOptions];\n\n// There is no global require in ESM, and we can't use dynamic import (which returns a promise) because it's called from the reporter's constructor; therefore, it must be synchronous.\nconst localRequire = typeof require === \"function\" ? require : createRequire(import.meta.url);\n\nexport const enableExtraReporters = (\n runner: Mocha.Runner,\n options: Mocha.MochaOptions,\n extraReportersConfig: ReporterEntry | readonly ReporterEntry[],\n) => {\n const extraReporterEntries = Array.from(generateCanonicalizedReporterEntries(extraReportersConfig));\n const loadedReporterEntries = loadReporters(extraReporterEntries);\n return instantiateReporters(runner, options, loadedReporterEntries);\n};\n\nexport const doneAll = (\n reporters: readonly Mocha.reporters.Base[],\n failures: number,\n fn?: ((failures: number) => void) | undefined,\n) => {\n const doneCallbacks = collectDoneCallbacks(reporters);\n let callbacksToWait = doneCallbacks.length + 1;\n const onReporterIsDone = () => {\n if (--callbacksToWait === 0) {\n fn?.(failures);\n }\n };\n\n for (const done of doneCallbacks) {\n done(failures, onReporterIsDone);\n }\n\n onReporterIsDone(); // handle the synchronous completion\n};\n\nconst generateCanonicalizedReporterEntries = function* (\n reporters: ReporterEntry | readonly ReporterEntry[] | undefined,\n): Generator<CanonicalReporterEntry, void, undefined> {\n if (reporters) {\n if (!(reporters instanceof Array)) {\n yield [reporters, {}];\n } else {\n if (isReporterArrayEntry(reporters)) {\n yield resolveReporterArrayEntry(reporters);\n } else {\n yield* reporters.map((e) => {\n return resolveReporterEntry(e);\n });\n }\n }\n }\n};\n\nconst loadReporters = (reporterEntries: readonly CanonicalReporterEntry[]): LoadedReporterEntry[] =>\n reporterEntries.map(([moduleOrCtor, options]) => [loadReporterModule(moduleOrCtor), options]);\n\nconst instantiateReporters = (\n runner: Mocha.Runner,\n options: Mocha.MochaOptions,\n entries: readonly LoadedReporterEntry[],\n) => {\n const reporters: Mocha.reporters.Base[] = [];\n for (const [Reporter, reporterOptions] of entries) {\n const optionsForReporter = {\n ...options,\n reporterOptions,\n // eslint-disable-next-line quote-props\n reporterOption: reporterOptions,\n \"reporter-option\": reporterOptions,\n };\n reporters.push(new Reporter(runner, optionsForReporter));\n }\n return reporters;\n};\n\nconst collectDoneCallbacks = (reporters: readonly Mocha.reporters.Base[]) => {\n const doneCallbacks: ReporterDoneFn[] = [];\n for (const reporter of reporters) {\n if (reporter.done) {\n doneCallbacks.push(reporter.done.bind(reporter));\n }\n }\n return doneCallbacks;\n};\n\nconst isReporterArrayEntry = (\n reporters: ShortReporterEntry | CanonicalReporterEntry | readonly ReporterEntry[],\n): reporters is ShortReporterEntry | CanonicalReporterEntry => {\n const [maybeReporterModuleOrCtor, maybeReporterOptions = {}] = reporters;\n return (\n !(maybeReporterModuleOrCtor instanceof Array) &&\n typeof maybeReporterOptions === \"object\" &&\n !(maybeReporterOptions instanceof Array)\n );\n};\n\nconst loadReporterModule = (moduleOrCtor: ReporterModuleOrCtor) => {\n if (typeof moduleOrCtor === \"string\") {\n const builtInReporters = Mocha.reporters as Record<string, Mocha.ReporterConstructor>;\n const builtInReporterCtor = builtInReporters[moduleOrCtor];\n if (builtInReporterCtor) {\n return builtInReporterCtor;\n }\n\n const reporterModulePath = getReporterModulePath(moduleOrCtor);\n try {\n return localRequire(reporterModulePath) as Mocha.ReporterConstructor;\n } catch (e: any) {\n throw new Error(`Can't load the '${moduleOrCtor}' reporter from ${reporterModulePath}: ${e.message}`);\n }\n }\n\n if (typeof moduleOrCtor !== \"function\") {\n throw new Error(`A reporter value must be a string or a constructor. Got ${typeof moduleOrCtor}`);\n }\n\n return moduleOrCtor;\n};\n\nconst getReporterModulePath = (module: string) => {\n try {\n return localRequire.resolve(module);\n } catch (e) {}\n\n try {\n return path.resolve(module);\n } catch (e: any) {\n throw new Error(`Can't resolve the '${module}' reporter's path: ${e.message}`);\n }\n};\n\nconst resolveReporterEntry = (reporterEntry: ReporterEntry): CanonicalReporterEntry => {\n return reporterEntry instanceof Array ? resolveReporterArrayEntry(reporterEntry) : [reporterEntry, {}];\n};\n\nconst resolveReporterArrayEntry = (\n reporterEntry: ShortReporterEntry | CanonicalReporterEntry,\n): CanonicalReporterEntry => {\n if (reporterEntry.length < 1 || reporterEntry.length > 2) {\n throw new Error(\n `If an extra reporter entry is an array, it must contain one or two elements. ${reporterEntry.length} found`,\n );\n }\n\n return reporterEntry.length === 1 ? [...reporterEntry, {}] : [...reporterEntry];\n};\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AAA6B,SAAAG,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,yBAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAAA,QAAAM,CAAA,GAAAH,wBAAA,CAAAE,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAP,CAAA,UAAAM,CAAA,CAAAE,GAAA,CAAAR,CAAA,OAAAS,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAA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Aa,CAAC,GAAG,CAACA,aAAa,EAAE,CAAC,CAAC,CAAC;AACxG,CAAC;AAED,IAAM1B,yBAAyB,GAC7B0B,aAA0D,IAC/B;EAC3B,IAAIA,aAAa,CAACpE,MAAM,GAAG,CAAC,IAAIoE,aAAa,CAACpE,MAAM,GAAG,CAAC,EAAE;IACxD,MAAM,IAAI8D,KAAK,iFAAAC,MAAA,CACmEK,aAAa,CAACpE,MAAM,WACtG,CAAC;EACH;EAEA,OAAOoE,aAAa,CAACpE,MAAM,KAAK,CAAC,GAAG,CAAC,GAAGoE,aAAa,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAGA,aAAa,CAAC;AACjF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"extraReporters.js","names":["Mocha","_interopRequireWildcard","require","_nodeModule","_nodePath","_interopRequireDefault","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","localRequire","createRequire","pathToFileURL","__filename","toString","enableExtraReporters","runner","options","extraReportersConfig","extraReporterEntries","Array","from","generateCanonicalizedReporterEntries","loadedReporterEntries","loadReporters","instantiateReporters","exports","doneAll","reporters","failures","fn","doneCallbacks","collectDoneCallbacks","callbacksToWait","onReporterIsDone","done","isReporterArrayEntry","resolveReporterArrayEntry","map","resolveReporterEntry","reporterEntries","_ref","moduleOrCtor","loadReporterModule","entries","Reporter","reporterOptions","optionsForReporter","reporter","bind","maybeReporterModuleOrCtor","maybeReporterOptions","builtInReporters","builtInReporterCtor","reporterModulePath","getReporterModulePath","Error","concat","message","module","resolve","path","reporterEntry"],"sources":["../../src/extraReporters.ts"],"sourcesContent":["import * as Mocha from \"mocha\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport type { ReporterDoneFn, ReporterEntry, ReporterModuleOrCtor, ReporterOptions } from \"./types.js\";\n\ntype CanonicalReporterEntry = readonly [ReporterModuleOrCtor, ReporterOptions];\ntype ShortReporterEntry = readonly [ReporterModuleOrCtor];\ntype LoadedReporterEntry = readonly [Mocha.ReporterConstructor, ReporterOptions];\n\n// There is no global require in ESM, and we can't use dynamic import (which returns a promise) because it's called from the reporter's constructor; therefore, it must be synchronous.\nconst localRequire = typeof require === \"function\" ? require : createRequire(import.meta.url);\n\nexport const enableExtraReporters = (\n runner: Mocha.Runner,\n options: Mocha.MochaOptions,\n extraReportersConfig: ReporterEntry | readonly ReporterEntry[],\n) => {\n const extraReporterEntries = Array.from(generateCanonicalizedReporterEntries(extraReportersConfig));\n const loadedReporterEntries = loadReporters(extraReporterEntries);\n return instantiateReporters(runner, options, loadedReporterEntries);\n};\n\nexport const doneAll = (\n reporters: readonly Mocha.reporters.Base[],\n failures: number,\n fn?: ((failures: number) => void) | undefined,\n) => {\n const doneCallbacks = collectDoneCallbacks(reporters);\n let callbacksToWait = doneCallbacks.length + 1;\n const onReporterIsDone = () => {\n if (--callbacksToWait === 0) {\n fn?.(failures);\n }\n };\n\n for (const done of doneCallbacks) {\n done(failures, onReporterIsDone);\n }\n\n onReporterIsDone(); // handle the synchronous completion\n};\n\nconst generateCanonicalizedReporterEntries = function* (\n reporters: ReporterEntry | readonly ReporterEntry[] | undefined,\n): Generator<CanonicalReporterEntry, void, undefined> {\n if (reporters) {\n if (!(reporters instanceof Array)) {\n yield [reporters, {}];\n } else {\n if (isReporterArrayEntry(reporters)) {\n yield resolveReporterArrayEntry(reporters);\n } else {\n yield* reporters.map((e) => {\n return resolveReporterEntry(e);\n });\n }\n }\n }\n};\n\nconst loadReporters = (reporterEntries: readonly CanonicalReporterEntry[]): LoadedReporterEntry[] =>\n reporterEntries.map(([moduleOrCtor, options]) => [loadReporterModule(moduleOrCtor), options]);\n\nconst instantiateReporters = (\n runner: Mocha.Runner,\n options: Mocha.MochaOptions,\n entries: readonly LoadedReporterEntry[],\n) => {\n const reporters: Mocha.reporters.Base[] = [];\n for (const [Reporter, reporterOptions] of entries) {\n const optionsForReporter = {\n ...options,\n reporterOptions,\n // eslint-disable-next-line quote-props\n \"reporterOption\": reporterOptions,\n \"reporter-option\": reporterOptions,\n };\n reporters.push(new Reporter(runner, optionsForReporter));\n }\n return reporters;\n};\n\nconst collectDoneCallbacks = (reporters: readonly Mocha.reporters.Base[]) => {\n const doneCallbacks: ReporterDoneFn[] = [];\n for (const reporter of reporters) {\n if (reporter.done) {\n doneCallbacks.push(reporter.done.bind(reporter));\n }\n }\n return doneCallbacks;\n};\n\nconst isReporterArrayEntry = (\n reporters: ShortReporterEntry | CanonicalReporterEntry | readonly ReporterEntry[],\n): reporters is ShortReporterEntry | CanonicalReporterEntry => {\n const [maybeReporterModuleOrCtor, maybeReporterOptions = {}] = reporters;\n return (\n !(maybeReporterModuleOrCtor instanceof Array) &&\n typeof maybeReporterOptions === \"object\" &&\n !(maybeReporterOptions instanceof Array)\n );\n};\n\nconst loadReporterModule = (moduleOrCtor: ReporterModuleOrCtor) => {\n if (typeof moduleOrCtor === \"string\") {\n const builtInReporters = Mocha.reporters as Record<string, Mocha.ReporterConstructor>;\n const builtInReporterCtor = builtInReporters[moduleOrCtor];\n if (builtInReporterCtor) {\n return builtInReporterCtor;\n }\n\n const reporterModulePath = getReporterModulePath(moduleOrCtor);\n try {\n return localRequire(reporterModulePath) as Mocha.ReporterConstructor;\n } catch (e: any) {\n throw new Error(`Can't load the '${moduleOrCtor}' reporter from ${reporterModulePath}: ${e.message}`);\n }\n }\n\n if (typeof moduleOrCtor !== \"function\") {\n throw new Error(`A reporter value must be a string or a constructor. Got ${typeof moduleOrCtor}`);\n }\n\n return moduleOrCtor;\n};\n\nconst getReporterModulePath = (module: string) => {\n try {\n return localRequire.resolve(module);\n } catch (e) {}\n\n try {\n return path.resolve(module);\n } catch (e: any) {\n throw new Error(`Can't resolve the '${module}' reporter's path: ${e.message}`);\n }\n};\n\nconst resolveReporterEntry = (reporterEntry: ReporterEntry): CanonicalReporterEntry => {\n return reporterEntry instanceof Array ? resolveReporterArrayEntry(reporterEntry) : [reporterEntry, {}];\n};\n\nconst resolveReporterArrayEntry = (\n reporterEntry: ShortReporterEntry | CanonicalReporterEntry,\n): CanonicalReporterEntry => {\n if (reporterEntry.length < 1 || reporterEntry.length > 2) {\n throw new Error(\n `If an extra reporter entry is an array, it must contain one or two elements. ${reporterEntry.length} found`,\n );\n }\n\n return reporterEntry.length === 1 ? [...reporterEntry, {}] : [...reporterEntry];\n};\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AAA6B,SAAAG,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,yBAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAAA,QAAAM,CAAA,GAAAH,wBAAA,CAAAE,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAP,CAAA,UAAAM,CAAA,CAAAE,GAAA,CAAAR,CAAA,OAAAS,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAA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AAa,CAAC,GAAG,CAACA,aAAa,EAAE,CAAC,CAAC,CAAC;AACxG,CAAC;AAED,IAAMzB,yBAAyB,GAC7ByB,aAA0D,IAC/B;EAC3B,IAAIA,aAAa,CAACnE,MAAM,GAAG,CAAC,IAAImE,aAAa,CAACnE,MAAM,GAAG,CAAC,EAAE;IACxD,MAAM,IAAI6D,KAAK,iFAAAC,MAAA,CACmEK,aAAa,CAACnE,MAAM,WACtG,CAAC;EACH;EAEA,OAAOmE,aAAa,CAACnE,MAAM,KAAK,CAAC,GAAG,CAAC,GAAGmE,aAAa,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAGA,aAAa,CAAC;AACjF,CAAC","ignoreList":[]}
|
|
@@ -51,7 +51,7 @@ var instantiateReporters = (runner, options, entries) => {
|
|
|
51
51
|
var optionsForReporter = _objectSpread(_objectSpread({}, options), {}, {
|
|
52
52
|
reporterOptions,
|
|
53
53
|
// eslint-disable-next-line quote-props
|
|
54
|
-
reporterOption: reporterOptions,
|
|
54
|
+
"reporterOption": reporterOptions,
|
|
55
55
|
"reporter-option": reporterOptions
|
|
56
56
|
});
|
|
57
57
|
reporters.push(new Reporter(runner, optionsForReporter));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extraReporters.js","names":["Mocha","createRequire","path","localRequire","require","import","meta","url","enableExtraReporters","runner","options","extraReportersConfig","extraReporterEntries","Array","from","generateCanonicalizedReporterEntries","loadedReporterEntries","loadReporters","instantiateReporters","doneAll","reporters","failures","fn","doneCallbacks","collectDoneCallbacks","callbacksToWait","length","onReporterIsDone","done","isReporterArrayEntry","resolveReporterArrayEntry","map","e","resolveReporterEntry","reporterEntries","_ref","moduleOrCtor","loadReporterModule","entries","Reporter","reporterOptions","optionsForReporter","_objectSpread","reporterOption","push","reporter","bind","maybeReporterModuleOrCtor","maybeReporterOptions","builtInReporters","builtInReporterCtor","reporterModulePath","getReporterModulePath","Error","concat","message","module","resolve","reporterEntry"],"sources":["../../src/extraReporters.ts"],"sourcesContent":["import * as Mocha from \"mocha\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport type { ReporterDoneFn, ReporterEntry, ReporterModuleOrCtor, ReporterOptions } from \"./types.js\";\n\ntype CanonicalReporterEntry = readonly [ReporterModuleOrCtor, ReporterOptions];\ntype ShortReporterEntry = readonly [ReporterModuleOrCtor];\ntype LoadedReporterEntry = readonly [Mocha.ReporterConstructor, ReporterOptions];\n\n// There is no global require in ESM, and we can't use dynamic import (which returns a promise) because it's called from the reporter's constructor; therefore, it must be synchronous.\nconst localRequire = typeof require === \"function\" ? require : createRequire(import.meta.url);\n\nexport const enableExtraReporters = (\n runner: Mocha.Runner,\n options: Mocha.MochaOptions,\n extraReportersConfig: ReporterEntry | readonly ReporterEntry[],\n) => {\n const extraReporterEntries = Array.from(generateCanonicalizedReporterEntries(extraReportersConfig));\n const loadedReporterEntries = loadReporters(extraReporterEntries);\n return instantiateReporters(runner, options, loadedReporterEntries);\n};\n\nexport const doneAll = (\n reporters: readonly Mocha.reporters.Base[],\n failures: number,\n fn?: ((failures: number) => void) | undefined,\n) => {\n const doneCallbacks = collectDoneCallbacks(reporters);\n let callbacksToWait = doneCallbacks.length + 1;\n const onReporterIsDone = () => {\n if (--callbacksToWait === 0) {\n fn?.(failures);\n }\n };\n\n for (const done of doneCallbacks) {\n done(failures, onReporterIsDone);\n }\n\n onReporterIsDone(); // handle the synchronous completion\n};\n\nconst generateCanonicalizedReporterEntries = function* (\n reporters: ReporterEntry | readonly ReporterEntry[] | undefined,\n): Generator<CanonicalReporterEntry, void, undefined> {\n if (reporters) {\n if (!(reporters instanceof Array)) {\n yield [reporters, {}];\n } else {\n if (isReporterArrayEntry(reporters)) {\n yield resolveReporterArrayEntry(reporters);\n } else {\n yield* reporters.map((e) => {\n return resolveReporterEntry(e);\n });\n }\n }\n }\n};\n\nconst loadReporters = (reporterEntries: readonly CanonicalReporterEntry[]): LoadedReporterEntry[] =>\n reporterEntries.map(([moduleOrCtor, options]) => [loadReporterModule(moduleOrCtor), options]);\n\nconst instantiateReporters = (\n runner: Mocha.Runner,\n options: Mocha.MochaOptions,\n entries: readonly LoadedReporterEntry[],\n) => {\n const reporters: Mocha.reporters.Base[] = [];\n for (const [Reporter, reporterOptions] of entries) {\n const optionsForReporter = {\n ...options,\n reporterOptions,\n // eslint-disable-next-line quote-props\n reporterOption: reporterOptions,\n \"reporter-option\": reporterOptions,\n };\n reporters.push(new Reporter(runner, optionsForReporter));\n }\n return reporters;\n};\n\nconst collectDoneCallbacks = (reporters: readonly Mocha.reporters.Base[]) => {\n const doneCallbacks: ReporterDoneFn[] = [];\n for (const reporter of reporters) {\n if (reporter.done) {\n doneCallbacks.push(reporter.done.bind(reporter));\n }\n }\n return doneCallbacks;\n};\n\nconst isReporterArrayEntry = (\n reporters: ShortReporterEntry | CanonicalReporterEntry | readonly ReporterEntry[],\n): reporters is ShortReporterEntry | CanonicalReporterEntry => {\n const [maybeReporterModuleOrCtor, maybeReporterOptions = {}] = reporters;\n return (\n !(maybeReporterModuleOrCtor instanceof Array) &&\n typeof maybeReporterOptions === \"object\" &&\n !(maybeReporterOptions instanceof Array)\n );\n};\n\nconst loadReporterModule = (moduleOrCtor: ReporterModuleOrCtor) => {\n if (typeof moduleOrCtor === \"string\") {\n const builtInReporters = Mocha.reporters as Record<string, Mocha.ReporterConstructor>;\n const builtInReporterCtor = builtInReporters[moduleOrCtor];\n if (builtInReporterCtor) {\n return builtInReporterCtor;\n }\n\n const reporterModulePath = getReporterModulePath(moduleOrCtor);\n try {\n return localRequire(reporterModulePath) as Mocha.ReporterConstructor;\n } catch (e: any) {\n throw new Error(`Can't load the '${moduleOrCtor}' reporter from ${reporterModulePath}: ${e.message}`);\n }\n }\n\n if (typeof moduleOrCtor !== \"function\") {\n throw new Error(`A reporter value must be a string or a constructor. Got ${typeof moduleOrCtor}`);\n }\n\n return moduleOrCtor;\n};\n\nconst getReporterModulePath = (module: string) => {\n try {\n return localRequire.resolve(module);\n } catch (e) {}\n\n try {\n return path.resolve(module);\n } catch (e: any) {\n throw new Error(`Can't resolve the '${module}' reporter's path: ${e.message}`);\n }\n};\n\nconst resolveReporterEntry = (reporterEntry: ReporterEntry): CanonicalReporterEntry => {\n return reporterEntry instanceof Array ? resolveReporterArrayEntry(reporterEntry) : [reporterEntry, {}];\n};\n\nconst resolveReporterArrayEntry = (\n reporterEntry: ShortReporterEntry | CanonicalReporterEntry,\n): CanonicalReporterEntry => {\n if (reporterEntry.length < 1 || reporterEntry.length > 2) {\n throw new Error(\n `If an extra reporter entry is an array, it must contain one or two elements. ${reporterEntry.length} found`,\n );\n }\n\n return reporterEntry.length === 1 ? [...reporterEntry, {}] : [...reporterEntry];\n};\n"],"mappings":";;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,aAAa,QAAQ,aAAa;AAC3C,OAAOC,IAAI,MAAM,WAAW;AAO5B;AACA,IAAMC,YAAY,GAAG,OAAOC,OAAO,KAAK,UAAU,GAAGA,OAAO,GAAGH,aAAa,CAACI,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC;AAE7F,OAAO,IAAMC,oBAAoB,GAAGA,CAClCC,MAAoB,EACpBC,OAA2B,EAC3BC,oBAA8D,KAC3D;EACH,IAAMC,oBAAoB,GAAGC,KAAK,CAACC,IAAI,CAACC,oCAAoC,CAACJ,oBAAoB,CAAC,CAAC;EACnG,IAAMK,qBAAqB,GAAGC,aAAa,CAACL,oBAAoB,CAAC;EACjE,OAAOM,oBAAoB,CAACT,MAAM,EAAEC,OAAO,EAAEM,qBAAqB,CAAC;AACrE,CAAC;AAED,OAAO,IAAMG,OAAO,GAAGA,CACrBC,SAA0C,EAC1CC,QAAgB,EAChBC,EAA6C,KAC1C;EACH,IAAMC,aAAa,GAAGC,oBAAoB,CAACJ,SAAS,CAAC;EACrD,IAAIK,eAAe,GAAGF,aAAa,CAACG,MAAM,GAAG,CAAC;EAC9C,IAAMC,gBAAgB,GAAGA,CAAA,KAAM;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ACuB,OAAO,CAAE,CAAC;IACvG;EACF;EAEA,IAAI,OAAOnB,YAAY,KAAK,UAAU,EAAE;IACtC,MAAM,IAAIiB,KAAK,4DAAAC,MAAA,CAA4D,OAAOlB,YAAY,CAAE,CAAC;EACnG;EAEA,OAAOA,YAAY;AACrB,CAAC;AAED,IAAMgB,qBAAqB,GAAII,MAAc,IAAK;EAChD,IAAI;IACF,OAAOrD,YAAY,CAACsD,OAAO,CAACD,MAAM,CAAC;EACrC,CAAC,CAAC,OAAOxB,CAAC,EAAE,CAAC;EAEb,IAAI;IACF,OAAO9B,IAAI,CAACuD,OAAO,CAACD,MAAM,CAAC;EAC7B,CAAC,CAAC,OAAOxB,CAAM,EAAE;IACf,MAAM,IAAIqB,KAAK,uBAAAC,MAAA,CAAuBE,MAAM,yBAAAF,MAAA,CAAsBtB,CAAC,CAACuB,OAAO,CAAE,CAAC;EAChF;AACF,CAAC;AAED,IAAMtB,oBAAoB,GAAIyB,aAA4B,IAA6B;EACrF,OAAOA,aAAa,YAAY7C,KAAK,GAAGiB,yBAAyB,CAAC4B,aAAa,CAAC,GAAG,CAACA,aAAa,EAAE,CAAC,CAAC,CAAC;AACxG,CAAC;AAED,IAAM5B,yBAAyB,GAC7B4B,aAA0D,IAC/B;EAC3B,IAAIA,aAAa,CAAChC,MAAM,GAAG,CAAC,IAAIgC,aAAa,CAAChC,MAAM,GAAG,CAAC,EAAE;IACxD,MAAM,IAAI2B,KAAK,iFAAAC,MAAA,CACmEI,aAAa,CAAChC,MAAM,WACtG,CAAC;EACH;EAEA,OAAOgC,aAAa,CAAChC,MAAM,KAAK,CAAC,GAAG,CAAC,GAAGgC,aAAa,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAGA,aAAa,CAAC;AACjF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"extraReporters.js","names":["Mocha","createRequire","path","localRequire","require","import","meta","url","enableExtraReporters","runner","options","extraReportersConfig","extraReporterEntries","Array","from","generateCanonicalizedReporterEntries","loadedReporterEntries","loadReporters","instantiateReporters","doneAll","reporters","failures","fn","doneCallbacks","collectDoneCallbacks","callbacksToWait","length","onReporterIsDone","done","isReporterArrayEntry","resolveReporterArrayEntry","map","e","resolveReporterEntry","reporterEntries","_ref","moduleOrCtor","loadReporterModule","entries","Reporter","reporterOptions","optionsForReporter","_objectSpread","push","reporter","bind","maybeReporterModuleOrCtor","maybeReporterOptions","builtInReporters","builtInReporterCtor","reporterModulePath","getReporterModulePath","Error","concat","message","module","resolve","reporterEntry"],"sources":["../../src/extraReporters.ts"],"sourcesContent":["import * as Mocha from \"mocha\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport type { ReporterDoneFn, ReporterEntry, ReporterModuleOrCtor, ReporterOptions } from \"./types.js\";\n\ntype CanonicalReporterEntry = readonly [ReporterModuleOrCtor, ReporterOptions];\ntype ShortReporterEntry = readonly [ReporterModuleOrCtor];\ntype LoadedReporterEntry = readonly [Mocha.ReporterConstructor, ReporterOptions];\n\n// There is no global require in ESM, and we can't use dynamic import (which returns a promise) because it's called from the reporter's constructor; therefore, it must be synchronous.\nconst localRequire = typeof require === \"function\" ? require : createRequire(import.meta.url);\n\nexport const enableExtraReporters = (\n runner: Mocha.Runner,\n options: Mocha.MochaOptions,\n extraReportersConfig: ReporterEntry | readonly ReporterEntry[],\n) => {\n const extraReporterEntries = Array.from(generateCanonicalizedReporterEntries(extraReportersConfig));\n const loadedReporterEntries = loadReporters(extraReporterEntries);\n return instantiateReporters(runner, options, loadedReporterEntries);\n};\n\nexport const doneAll = (\n reporters: readonly Mocha.reporters.Base[],\n failures: number,\n fn?: ((failures: number) => void) | undefined,\n) => {\n const doneCallbacks = collectDoneCallbacks(reporters);\n let callbacksToWait = doneCallbacks.length + 1;\n const onReporterIsDone = () => {\n if (--callbacksToWait === 0) {\n fn?.(failures);\n }\n };\n\n for (const done of doneCallbacks) {\n done(failures, onReporterIsDone);\n }\n\n onReporterIsDone(); // handle the synchronous completion\n};\n\nconst generateCanonicalizedReporterEntries = function* (\n reporters: ReporterEntry | readonly ReporterEntry[] | undefined,\n): Generator<CanonicalReporterEntry, void, undefined> {\n if (reporters) {\n if (!(reporters instanceof Array)) {\n yield [reporters, {}];\n } else {\n if (isReporterArrayEntry(reporters)) {\n yield resolveReporterArrayEntry(reporters);\n } else {\n yield* reporters.map((e) => {\n return resolveReporterEntry(e);\n });\n }\n }\n }\n};\n\nconst loadReporters = (reporterEntries: readonly CanonicalReporterEntry[]): LoadedReporterEntry[] =>\n reporterEntries.map(([moduleOrCtor, options]) => [loadReporterModule(moduleOrCtor), options]);\n\nconst instantiateReporters = (\n runner: Mocha.Runner,\n options: Mocha.MochaOptions,\n entries: readonly LoadedReporterEntry[],\n) => {\n const reporters: Mocha.reporters.Base[] = [];\n for (const [Reporter, reporterOptions] of entries) {\n const optionsForReporter = {\n ...options,\n reporterOptions,\n // eslint-disable-next-line quote-props\n \"reporterOption\": reporterOptions,\n \"reporter-option\": reporterOptions,\n };\n reporters.push(new Reporter(runner, optionsForReporter));\n }\n return reporters;\n};\n\nconst collectDoneCallbacks = (reporters: readonly Mocha.reporters.Base[]) => {\n const doneCallbacks: ReporterDoneFn[] = [];\n for (const reporter of reporters) {\n if (reporter.done) {\n doneCallbacks.push(reporter.done.bind(reporter));\n }\n }\n return doneCallbacks;\n};\n\nconst isReporterArrayEntry = (\n reporters: ShortReporterEntry | CanonicalReporterEntry | readonly ReporterEntry[],\n): reporters is ShortReporterEntry | CanonicalReporterEntry => {\n const [maybeReporterModuleOrCtor, maybeReporterOptions = {}] = reporters;\n return (\n !(maybeReporterModuleOrCtor instanceof Array) &&\n typeof maybeReporterOptions === \"object\" &&\n !(maybeReporterOptions instanceof Array)\n );\n};\n\nconst loadReporterModule = (moduleOrCtor: ReporterModuleOrCtor) => {\n if (typeof moduleOrCtor === \"string\") {\n const builtInReporters = Mocha.reporters as Record<string, Mocha.ReporterConstructor>;\n const builtInReporterCtor = builtInReporters[moduleOrCtor];\n if (builtInReporterCtor) {\n return builtInReporterCtor;\n }\n\n const reporterModulePath = getReporterModulePath(moduleOrCtor);\n try {\n return localRequire(reporterModulePath) as Mocha.ReporterConstructor;\n } catch (e: any) {\n throw new Error(`Can't load the '${moduleOrCtor}' reporter from ${reporterModulePath}: ${e.message}`);\n }\n }\n\n if (typeof moduleOrCtor !== \"function\") {\n throw new Error(`A reporter value must be a string or a constructor. Got ${typeof moduleOrCtor}`);\n }\n\n return moduleOrCtor;\n};\n\nconst getReporterModulePath = (module: string) => {\n try {\n return localRequire.resolve(module);\n } catch (e) {}\n\n try {\n return path.resolve(module);\n } catch (e: any) {\n throw new Error(`Can't resolve the '${module}' reporter's path: ${e.message}`);\n }\n};\n\nconst resolveReporterEntry = (reporterEntry: ReporterEntry): CanonicalReporterEntry => {\n return reporterEntry instanceof Array ? resolveReporterArrayEntry(reporterEntry) : [reporterEntry, {}];\n};\n\nconst resolveReporterArrayEntry = (\n reporterEntry: ShortReporterEntry | CanonicalReporterEntry,\n): CanonicalReporterEntry => {\n if (reporterEntry.length < 1 || reporterEntry.length > 2) {\n throw new Error(\n `If an extra reporter entry is an array, it must contain one or two elements. ${reporterEntry.length} found`,\n );\n }\n\n return reporterEntry.length === 1 ? [...reporterEntry, {}] : [...reporterEntry];\n};\n"],"mappings":";;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,aAAa,QAAQ,aAAa;AAC3C,OAAOC,IAAI,MAAM,WAAW;AAO5B;AACA,IAAMC,YAAY,GAAG,OAAOC,OAAO,KAAK,UAAU,GAAGA,OAAO,GAAGH,aAAa,CAACI,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC;AAE7F,OAAO,IAAMC,oBAAoB,GAAGA,CAClCC,MAAoB,EACpBC,OAA2B,EAC3BC,oBAA8D,KAC3D;EACH,IAAMC,oBAAoB,GAAGC,KAAK,CAACC,IAAI,CAACC,oCAAoC,CAACJ,oBAAoB,CAAC,CAAC;EACnG,IAAMK,qBAAqB,G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AM,IAAI0B,KAAK,iFAAAC,MAAA,CACmEI,aAAa,CAAC/B,MAAM,WACtG,CAAC;EACH;EAEA,OAAO+B,aAAa,CAAC/B,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG+B,aAAa,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAGA,aAAa,CAAC;AACjF,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "allure-mocha",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.8",
|
|
4
4
|
"description": "Allure Mocha integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"test:runner-parallel": "ALLURE_MOCHA_TEST_RUNNER=esm ALLURE_MOCHA_TEST_SPEC_FORMAT=esm ALLURE_MOCHA_TEST_PARALLEL=true vitest run"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"allure-js-commons": "3.0.
|
|
63
|
+
"allure-js-commons": "3.0.8"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@babel/cli": "^7.24.6",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
77
77
|
"@typescript-eslint/parser": "^8.0.0",
|
|
78
78
|
"allure-commandline": "^2.29.0",
|
|
79
|
-
"allure-vitest": "3.0.
|
|
79
|
+
"allure-vitest": "3.0.8",
|
|
80
80
|
"babel-plugin-add-module-exports": "^1.0.4",
|
|
81
81
|
"babel-plugin-transform-import-meta": "^2.2.1",
|
|
82
82
|
"eslint": "^8.57.0",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"eslint-plugin-no-null": "^1.0.2",
|
|
88
88
|
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
89
89
|
"glob": "^11.0.0",
|
|
90
|
-
"mocha": "^
|
|
90
|
+
"mocha": "^11.0.0",
|
|
91
91
|
"npm-run-all2": "^7.0.0",
|
|
92
92
|
"rimraf": "^6.0.0",
|
|
93
93
|
"typescript": "^5.2.2",
|