@storybook/addon-vitest 9.2.0-alpha.3 → 10.0.0-beta.0
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.
- package/README.md +2 -0
- package/dist/_browser-chunks/chunk-JK72E6FR.js +6 -0
- package/dist/_browser-chunks/chunk-PMYV6BH2.js +76 -0
- package/dist/_node-chunks/chunk-2LKDLHP2.js +91 -0
- package/dist/_node-chunks/chunk-75PF53UG.js +103 -0
- package/dist/_node-chunks/chunk-EZERIZC2.js +481 -0
- package/dist/_node-chunks/chunk-FJO43W6J.js +37 -0
- package/dist/_node-chunks/chunk-HIDBMPI3.js +247 -0
- package/dist/_node-chunks/chunk-MHHQUJAV.js +50 -0
- package/dist/_node-chunks/chunk-MJKNSUFZ.js +295 -0
- package/dist/_node-chunks/chunk-T7EST64K.js +2264 -0
- package/dist/index.js +9 -6
- package/dist/manager.js +955 -8
- package/dist/node/coverage-reporter.js +1898 -4
- package/dist/node/vitest.js +871 -17
- package/dist/postinstall.js +2076 -88
- package/dist/preset.js +615 -35
- package/dist/vitest-plugin/global-setup.js +200 -6
- package/dist/vitest-plugin/index.js +3823 -43
- package/dist/vitest-plugin/setup-file.js +30 -8
- package/dist/vitest-plugin/test-utils.js +102 -8
- package/manager.js +1 -1
- package/package.json +27 -93
- package/preset.js +1 -1
- package/dist/chunk-55WZLVGN.mjs +0 -11
- package/dist/chunk-JKRQGT2U.mjs +0 -10
- package/dist/index.mjs +0 -5
- package/dist/node/coverage-reporter.d.ts +0 -184
- package/dist/node/coverage-reporter.mjs +0 -12
- package/dist/node/vitest.d.ts +0 -2
- package/dist/node/vitest.mjs +0 -19
- package/dist/vitest-plugin/global-setup.d.ts +0 -6
- package/dist/vitest-plugin/global-setup.mjs +0 -13
- package/dist/vitest-plugin/index.mjs +0 -28
- package/dist/vitest-plugin/setup-file.d.ts +0 -14
- package/dist/vitest-plugin/setup-file.mjs +0 -9
- package/dist/vitest-plugin/test-utils.d.ts +0 -20
- package/dist/vitest-plugin/test-utils.mjs +0 -8
- package/manager.mjs +0 -1
- package/postinstall.js +0 -1
- package/postinstall.mjs +0 -1
- package/preset.mjs +0 -1
|
@@ -1,6 +1,1900 @@
|
|
|
1
|
-
|
|
1
|
+
import CJS_COMPAT_NODE_URL_nt0sybtpwl from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_nt0sybtpwl from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_nt0sybtpwl from "node:module";
|
|
2
4
|
|
|
3
|
-
var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __require=(x=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(x,{get:(a,b)=>(typeof require<"u"?require:a)[b]}):x)(function(x){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+x+'" is not supported')});var __commonJS=(cb,mod)=>function(){return mod||(0, cb[__getOwnPropNames(cb)[0]])((mod={exports:{}}).exports,mod),mod.exports};var __copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod));var require_debug=__commonJS({"../../node_modules/semver/internal/debug.js"(exports,module){var debug=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...args)=>console.error("SEMVER",...args):()=>{};module.exports=debug;}});var require_constants=__commonJS({"../../node_modules/semver/internal/constants.js"(exports,module){var SEMVER_SPEC_VERSION="2.0.0",MAX_SAFE_INTEGER=Number.MAX_SAFE_INTEGER||9007199254740991,MAX_SAFE_COMPONENT_LENGTH=16,MAX_SAFE_BUILD_LENGTH=250,RELEASE_TYPES=["major","premajor","minor","preminor","patch","prepatch","prerelease"];module.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH,MAX_SAFE_BUILD_LENGTH,MAX_SAFE_INTEGER,RELEASE_TYPES,SEMVER_SPEC_VERSION,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2};}});var require_re=__commonJS({"../../node_modules/semver/internal/re.js"(exports,module){var{MAX_SAFE_COMPONENT_LENGTH,MAX_SAFE_BUILD_LENGTH,MAX_LENGTH}=require_constants(),debug=require_debug();exports=module.exports={};var re=exports.re=[],safeRe=exports.safeRe=[],src=exports.src=[],safeSrc=exports.safeSrc=[],t=exports.t={},R=0,LETTERDASHNUMBER="[a-zA-Z0-9-]",safeRegexReplacements=[["\\s",1],["\\d",MAX_LENGTH],[LETTERDASHNUMBER,MAX_SAFE_BUILD_LENGTH]],makeSafeRegex=value=>{for(let[token,max]of safeRegexReplacements)value=value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);return value},createToken=(name,value,isGlobal)=>{let safe=makeSafeRegex(value),index=R++;debug(name,index,value),t[name]=index,src[index]=value,safeSrc[index]=safe,re[index]=new RegExp(value,isGlobal?"g":void 0),safeRe[index]=new RegExp(safe,isGlobal?"g":void 0);};createToken("NUMERICIDENTIFIER","0|[1-9]\\d*");createToken("NUMERICIDENTIFIERLOOSE","\\d+");createToken("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);createToken("MAINVERSION",`(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);createToken("MAINVERSIONLOOSE",`(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);createToken("PRERELEASEIDENTIFIER",`(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);createToken("PRERELEASEIDENTIFIERLOOSE",`(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);createToken("PRERELEASE",`(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);createToken("PRERELEASELOOSE",`(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);createToken("BUILDIDENTIFIER",`${LETTERDASHNUMBER}+`);createToken("BUILD",`(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);createToken("FULLPLAIN",`v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);createToken("FULL",`^${src[t.FULLPLAIN]}$`);createToken("LOOSEPLAIN",`[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);createToken("LOOSE",`^${src[t.LOOSEPLAIN]}$`);createToken("GTLT","((?:<|>)?=?)");createToken("XRANGEIDENTIFIERLOOSE",`${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);createToken("XRANGEIDENTIFIER",`${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);createToken("XRANGEPLAIN",`[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);createToken("XRANGEPLAINLOOSE",`[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);createToken("XRANGE",`^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);createToken("XRANGELOOSE",`^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);createToken("COERCEPLAIN",`(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);createToken("COERCE",`${src[t.COERCEPLAIN]}(?:$|[^\\d])`);createToken("COERCEFULL",src[t.COERCEPLAIN]+`(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);createToken("COERCERTL",src[t.COERCE],!0);createToken("COERCERTLFULL",src[t.COERCEFULL],!0);createToken("LONETILDE","(?:~>?)");createToken("TILDETRIM",`(\\s*)${src[t.LONETILDE]}\\s+`,!0);exports.tildeTrimReplace="$1~";createToken("TILDE",`^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);createToken("TILDELOOSE",`^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);createToken("LONECARET","(?:\\^)");createToken("CARETTRIM",`(\\s*)${src[t.LONECARET]}\\s+`,!0);exports.caretTrimReplace="$1^";createToken("CARET",`^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);createToken("CARETLOOSE",`^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);createToken("COMPARATORLOOSE",`^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);createToken("COMPARATOR",`^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);createToken("COMPARATORTRIM",`(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`,!0);exports.comparatorTrimReplace="$1$2$3";createToken("HYPHENRANGE",`^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);createToken("HYPHENRANGELOOSE",`^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);createToken("STAR","(<|>)?=?\\s*\\*");createToken("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");createToken("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$");}});var require_parse_options=__commonJS({"../../node_modules/semver/internal/parse-options.js"(exports,module){var looseOption=Object.freeze({loose:!0}),emptyOpts=Object.freeze({}),parseOptions=options=>options?typeof options!="object"?looseOption:options:emptyOpts;module.exports=parseOptions;}});var require_identifiers=__commonJS({"../../node_modules/semver/internal/identifiers.js"(exports,module){var numeric=/^[0-9]+$/,compareIdentifiers=(a,b)=>{let anum=numeric.test(a),bnum=numeric.test(b);return anum&&bnum&&(a=+a,b=+b),a===b?0:anum&&!bnum?-1:bnum&&!anum?1:a<b?-1:1},rcompareIdentifiers=(a,b)=>compareIdentifiers(b,a);module.exports={compareIdentifiers,rcompareIdentifiers};}});var require_semver=__commonJS({"../../node_modules/semver/classes/semver.js"(exports,module){var debug=require_debug(),{MAX_LENGTH,MAX_SAFE_INTEGER}=require_constants(),{safeRe:re,t}=require_re(),parseOptions=require_parse_options(),{compareIdentifiers}=require_identifiers(),SemVer=class _SemVer{constructor(version,options){if(options=parseOptions(options),version instanceof _SemVer){if(version.loose===!!options.loose&&version.includePrerelease===!!options.includePrerelease)return version;version=version.version;}else if(typeof version!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);if(version.length>MAX_LENGTH)throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);debug("SemVer",version,options),this.options=options,this.loose=!!options.loose,this.includePrerelease=!!options.includePrerelease;let m=version.trim().match(options.loose?re[t.LOOSE]:re[t.FULL]);if(!m)throw new TypeError(`Invalid Version: ${version}`);if(this.raw=version,this.major=+m[1],this.minor=+m[2],this.patch=+m[3],this.major>MAX_SAFE_INTEGER||this.major<0)throw new TypeError("Invalid major version");if(this.minor>MAX_SAFE_INTEGER||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>MAX_SAFE_INTEGER||this.patch<0)throw new TypeError("Invalid patch version");m[4]?this.prerelease=m[4].split(".").map(id=>{if(/^[0-9]+$/.test(id)){let num=+id;if(num>=0&&num<MAX_SAFE_INTEGER)return num}return id}):this.prerelease=[],this.build=m[5]?m[5].split("."):[],this.format();}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(other){if(debug("SemVer.compare",this.version,this.options,other),!(other instanceof _SemVer)){if(typeof other=="string"&&other===this.version)return 0;other=new _SemVer(other,this.options);}return other.version===this.version?0:this.compareMain(other)||this.comparePre(other)}compareMain(other){return other instanceof _SemVer||(other=new _SemVer(other,this.options)),compareIdentifiers(this.major,other.major)||compareIdentifiers(this.minor,other.minor)||compareIdentifiers(this.patch,other.patch)}comparePre(other){if(other instanceof _SemVer||(other=new _SemVer(other,this.options)),this.prerelease.length&&!other.prerelease.length)return -1;if(!this.prerelease.length&&other.prerelease.length)return 1;if(!this.prerelease.length&&!other.prerelease.length)return 0;let i=0;do{let a=this.prerelease[i],b=other.prerelease[i];if(debug("prerelease compare",i,a,b),a===void 0&&b===void 0)return 0;if(b===void 0)return 1;if(a===void 0)return -1;if(a===b)continue;return compareIdentifiers(a,b)}while(++i)}compareBuild(other){other instanceof _SemVer||(other=new _SemVer(other,this.options));let i=0;do{let a=this.build[i],b=other.build[i];if(debug("build compare",i,a,b),a===void 0&&b===void 0)return 0;if(b===void 0)return 1;if(a===void 0)return -1;if(a===b)continue;return compareIdentifiers(a,b)}while(++i)}inc(release,identifier,identifierBase){if(release.startsWith("pre")){if(!identifier&&identifierBase===!1)throw new Error("invalid increment argument: identifier is empty");if(identifier){let match=`-${identifier}`.match(this.options.loose?re[t.PRERELEASELOOSE]:re[t.PRERELEASE]);if(!match||match[1]!==identifier)throw new Error(`invalid identifier: ${identifier}`)}}switch(release){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",identifier,identifierBase);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",identifier,identifierBase);break;case"prepatch":this.prerelease.length=0,this.inc("patch",identifier,identifierBase),this.inc("pre",identifier,identifierBase);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",identifier,identifierBase),this.inc("pre",identifier,identifierBase);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let base=Number(identifierBase)?1:0;if(this.prerelease.length===0)this.prerelease=[base];else {let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(identifier===this.prerelease.join(".")&&identifierBase===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(base);}}if(identifier){let prerelease=[identifier,base];identifierBase===!1&&(prerelease=[identifier]),compareIdentifiers(this.prerelease[0],identifier)===0?isNaN(this.prerelease[1])&&(this.prerelease=prerelease):this.prerelease=prerelease;}break}default:throw new Error(`invalid increment argument: ${release}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};module.exports=SemVer;}});var require_compare=__commonJS({"../../node_modules/semver/functions/compare.js"(exports,module){var SemVer=require_semver(),compare=(a,b,loose)=>new SemVer(a,loose).compare(new SemVer(b,loose));module.exports=compare;}});var require_gte=__commonJS({"../../node_modules/semver/functions/gte.js"(exports,module){var compare=require_compare(),gte=(a,b,loose)=>compare(a,b,loose)>=0;module.exports=gte;}});var require_make_dir=__commonJS({"../../node_modules/istanbul-lib-report/node_modules/make-dir/index.js"(exports,module){var fs=__require("fs"),path=__require("path"),{promisify}=__require("util"),semverGte=require_gte(),useNativeRecursiveOption=semverGte(process.version,"10.12.0"),checkPath=pth=>{if(process.platform==="win32"&&/[<>:"|?*]/.test(pth.replace(path.parse(pth).root,""))){let error=new Error(`Path contains invalid characters: ${pth}`);throw error.code="EINVAL",error}},processOptions=options=>({...{mode:511,fs},...options}),permissionError=pth=>{let error=new Error(`operation not permitted, mkdir '${pth}'`);return error.code="EPERM",error.errno=-4048,error.path=pth,error.syscall="mkdir",error},makeDir=async(input,options)=>{checkPath(input),options=processOptions(options);let mkdir=promisify(options.fs.mkdir),stat=promisify(options.fs.stat);if(useNativeRecursiveOption&&options.fs.mkdir===fs.mkdir){let pth=path.resolve(input);return await mkdir(pth,{mode:options.mode,recursive:!0}),pth}let make=async pth=>{try{return await mkdir(pth,options.mode),pth}catch(error){if(error.code==="EPERM")throw error;if(error.code==="ENOENT"){if(path.dirname(pth)===pth)throw permissionError(pth);if(error.message.includes("null bytes"))throw error;return await make(path.dirname(pth)),make(pth)}try{if(!(await stat(pth)).isDirectory())throw new Error("The path is not a directory")}catch{throw error}return pth}};return make(path.resolve(input))};module.exports=makeDir;module.exports.sync=(input,options)=>{if(checkPath(input),options=processOptions(options),useNativeRecursiveOption&&options.fs.mkdirSync===fs.mkdirSync){let pth=path.resolve(input);return fs.mkdirSync(pth,{mode:options.mode,recursive:!0}),pth}let make=pth=>{try{options.fs.mkdirSync(pth,options.mode);}catch(error){if(error.code==="EPERM")throw error;if(error.code==="ENOENT"){if(path.dirname(pth)===pth)throw permissionError(pth);if(error.message.includes("null bytes"))throw error;return make(path.dirname(pth)),make(pth)}try{if(!options.fs.statSync(pth).isDirectory())throw new Error("The path is not a directory")}catch{throw error}}return pth};return make(path.resolve(input))};}});var require_has_flag=__commonJS({"../../node_modules/has-flag/index.js"(exports,module){module.exports=(flag,argv=process.argv)=>{let prefix=flag.startsWith("-")?"":flag.length===1?"-":"--",position=argv.indexOf(prefix+flag),terminatorPosition=argv.indexOf("--");return position!==-1&&(terminatorPosition===-1||position<terminatorPosition)};}});var require_supports_color=__commonJS({"../../node_modules/supports-color/index.js"(exports,module){var os=__require("os"),tty=__require("tty"),hasFlag=require_has_flag(),{env}=process,forceColor;hasFlag("no-color")||hasFlag("no-colors")||hasFlag("color=false")||hasFlag("color=never")?forceColor=0:(hasFlag("color")||hasFlag("colors")||hasFlag("color=true")||hasFlag("color=always"))&&(forceColor=1);"FORCE_COLOR"in env&&(env.FORCE_COLOR==="true"?forceColor=1:env.FORCE_COLOR==="false"?forceColor=0:forceColor=env.FORCE_COLOR.length===0?1:Math.min(parseInt(env.FORCE_COLOR,10),3));function translateLevel(level){return level===0?!1:{level,hasBasic:!0,has256:level>=2,has16m:level>=3}}function supportsColor(haveStream,streamIsTTY){if(forceColor===0)return 0;if(hasFlag("color=16m")||hasFlag("color=full")||hasFlag("color=truecolor"))return 3;if(hasFlag("color=256"))return 2;if(haveStream&&!streamIsTTY&&forceColor===void 0)return 0;let min=forceColor||0;if(env.TERM==="dumb")return min;if(process.platform==="win32"){let osRelease=os.release().split(".");return Number(osRelease[0])>=10&&Number(osRelease[2])>=10586?Number(osRelease[2])>=14931?3:2:1}if("CI"in env)return ["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(sign=>sign in env)||env.CI_NAME==="codeship"?1:min;if("TEAMCITY_VERSION"in env)return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION)?1:0;if(env.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in env){let version=parseInt((env.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(env.TERM_PROGRAM){case"iTerm.app":return version>=3?3:2;case"Apple_Terminal":return 2}}return /-256(color)?$/i.test(env.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)||"COLORTERM"in env?1:min}function getSupportLevel(stream){let level=supportsColor(stream,stream&&stream.isTTY);return translateLevel(level)}module.exports={supportsColor:getSupportLevel,stdout:translateLevel(supportsColor(!0,tty.isatty(1))),stderr:translateLevel(supportsColor(!0,tty.isatty(2)))};}});var require_file_writer=__commonJS({"../../node_modules/istanbul-lib-report/lib/file-writer.js"(exports,module){var path=__require("path"),fs=__require("fs"),mkdirp=require_make_dir(),supportsColor=require_supports_color(),ContentWriter=class{colorize(str){return str}println(str){this.write(`${str}
|
|
4
|
-
`);}close(){}},FileContentWriter=class extends ContentWriter{constructor(fd){super(),this.fd=fd;}write(str){fs.writeSync(this.fd,str);}close(){fs.closeSync(this.fd);}},capture=!1,output="",ConsoleWriter=class extends ContentWriter{write(str){capture?output+=str:process.stdout.write(str);}colorize(str,clazz){let colors={low:"31;1",medium:"33;1",high:"32;1"};return supportsColor.stdout&&colors[clazz]?`\x1B[${colors[clazz]}m${str}\x1B[0m`:str}},FileWriter=class _FileWriter{constructor(baseDir){if(!baseDir)throw new Error("baseDir must be specified");this.baseDir=baseDir;}static startCapture(){capture=!0;}static stopCapture(){capture=!1;}static getOutput(){return output}static resetOutput(){output="";}writerForDir(subdir){if(path.isAbsolute(subdir))throw new Error(`Cannot create subdir writer for absolute path: ${subdir}`);return new _FileWriter(`${this.baseDir}/${subdir}`)}copyFile(source,dest,header){if(path.isAbsolute(dest))throw new Error(`Cannot write to absolute path: ${dest}`);dest=path.resolve(this.baseDir,dest),mkdirp.sync(path.dirname(dest));let contents;header?contents=header+fs.readFileSync(source,"utf8"):contents=fs.readFileSync(source),fs.writeFileSync(dest,contents);}writeFile(file){if(file===null||file==="-")return new ConsoleWriter;if(path.isAbsolute(file))throw new Error(`Cannot write to absolute path: ${file}`);return file=path.resolve(this.baseDir,file),mkdirp.sync(path.dirname(file)),new FileContentWriter(fs.openSync(file,"w"))}};module.exports=FileWriter;}});var require_xml_writer=__commonJS({"../../node_modules/istanbul-lib-report/lib/xml-writer.js"(exports,module){var INDENT=" ";function attrString(attrs){return Object.entries(attrs||{}).map(([k,v])=>` ${k}="${v}"`).join("")}var XMLWriter=class{constructor(contentWriter){this.cw=contentWriter,this.stack=[];}indent(str){return this.stack.map(()=>INDENT).join("")+str}openTag(name,attrs){let str=this.indent(`<${name+attrString(attrs)}>`);this.cw.println(str),this.stack.push(name);}closeTag(name){if(this.stack.length===0)throw new Error(`Attempt to close tag ${name} when not opened`);let stashed=this.stack.pop(),str=`</${name}>`;if(stashed!==name)throw new Error(`Attempt to close tag ${name} when ${stashed} was the one open`);this.cw.println(this.indent(str));}inlineTag(name,attrs,content){let str="<"+name+attrString(attrs);content?str+=`>${content}</${name}>`:str+="/>",str=this.indent(str),this.cw.println(str);}closeAll(){this.stack.slice().reverse().forEach(name=>{this.closeTag(name);});}};module.exports=XMLWriter;}});var require_tree=__commonJS({"../../node_modules/istanbul-lib-report/lib/tree.js"(exports,module){var Visitor=class{constructor(delegate){this.delegate=delegate;}};["Start","End","Summary","SummaryEnd","Detail"].map(k=>`on${k}`).forEach(fn=>{Object.defineProperty(Visitor.prototype,fn,{writable:!0,value(node,state){typeof this.delegate[fn]=="function"&&this.delegate[fn](node,state);}});});var CompositeVisitor=class extends Visitor{constructor(visitors){super(),Array.isArray(visitors)||(visitors=[visitors]),this.visitors=visitors.map(v=>v instanceof Visitor?v:new Visitor(v));}};["Start","Summary","SummaryEnd","Detail","End"].map(k=>`on${k}`).forEach(fn=>{Object.defineProperty(CompositeVisitor.prototype,fn,{value(node,state){this.visitors.forEach(v=>{v[fn](node,state);});}});});var BaseNode=class{isRoot(){return !this.getParent()}visit(visitor,state){this.isSummary()?visitor.onSummary(this,state):visitor.onDetail(this,state),this.getChildren().forEach(child=>{child.visit(visitor,state);}),this.isSummary()&&visitor.onSummaryEnd(this,state);}},BaseTree=class{constructor(root){this.root=root;}getRoot(){return this.root}visit(visitor,state){visitor instanceof Visitor||(visitor=new Visitor(visitor)),visitor.onStart(this.getRoot(),state),this.getRoot().visit(visitor,state),visitor.onEnd(this.getRoot(),state);}};module.exports={BaseTree,BaseNode,Visitor,CompositeVisitor};}});var require_watermarks=__commonJS({"../../node_modules/istanbul-lib-report/lib/watermarks.js"(exports,module){module.exports={getDefault(){return {statements:[50,80],functions:[50,80],branches:[50,80],lines:[50,80]}}};}});var require_percent=__commonJS({"../../node_modules/istanbul-lib-coverage/lib/percent.js"(exports,module){module.exports=function(covered,total){let tmp;return total>0?(tmp=1e3*100*covered/total,Math.floor(tmp/10)/100):100};}});var require_data_properties=__commonJS({"../../node_modules/istanbul-lib-coverage/lib/data-properties.js"(exports,module){module.exports=function(klass,properties){properties.forEach(p=>{Object.defineProperty(klass.prototype,p,{enumerable:!0,get(){return this.data[p]}});});};}});var require_coverage_summary=__commonJS({"../../node_modules/istanbul-lib-coverage/lib/coverage-summary.js"(exports,module){var percent=require_percent(),dataProperties=require_data_properties();function blankSummary(){let empty=()=>({total:0,covered:0,skipped:0,pct:"Unknown"});return {lines:empty(),statements:empty(),functions:empty(),branches:empty(),branchesTrue:empty()}}function assertValidSummary(obj){if(!(obj&&obj.lines&&obj.statements&&obj.functions&&obj.branches))throw new Error("Invalid summary coverage object, missing keys, found:"+Object.keys(obj).join(","))}var CoverageSummary=class _CoverageSummary{constructor(obj){obj?obj instanceof _CoverageSummary?this.data=obj.data:this.data=obj:this.data=blankSummary(),assertValidSummary(this.data);}merge(obj){return ["lines","statements","branches","functions","branchesTrue"].forEach(key=>{obj[key]&&(this[key].total+=obj[key].total,this[key].covered+=obj[key].covered,this[key].skipped+=obj[key].skipped,this[key].pct=percent(this[key].covered,this[key].total));}),this}toJSON(){return this.data}isEmpty(){return this.lines.total===0}};dataProperties(CoverageSummary,["lines","statements","functions","branches","branchesTrue"]);module.exports={CoverageSummary};}});var require_file_coverage=__commonJS({"../../node_modules/istanbul-lib-coverage/lib/file-coverage.js"(exports,module){var percent=require_percent(),dataProperties=require_data_properties(),{CoverageSummary}=require_coverage_summary();function emptyCoverage(filePath,reportLogic){let cov={path:filePath,statementMap:{},fnMap:{},branchMap:{},s:{},f:{},b:{}};return reportLogic&&(cov.bT={}),cov}function assertValidObject(obj){if(!(obj&&obj.path&&obj.statementMap&&obj.fnMap&&obj.branchMap&&obj.s&&obj.f&&obj.b))throw new Error("Invalid file coverage object, missing keys, found:"+Object.keys(obj).join(","))}var keyFromLoc=({start,end})=>`${start.line}|${start.column}|${end.line}|${end.column}`,isObj=o=>!!o&&typeof o=="object",isLineCol=o=>isObj(o)&&typeof o.line=="number"&&typeof o.column=="number",isLoc=o=>isObj(o)&&isLineCol(o.start)&&isLineCol(o.end),getLoc=o=>isLoc(o)?o:isLoc(o.loc)?o.loc:null,findNearestContainer=(item,map)=>{let itemLoc=getLoc(item);if(!itemLoc)return null;let nearestContainingItem=null,containerDistance=null,containerKey=null;for(let[i,mapItem]of Object.entries(map)){let mapLoc=getLoc(mapItem);if(!mapLoc)continue;let distance=[itemLoc.start.line-mapLoc.start.line,itemLoc.start.column-mapLoc.start.column,mapLoc.end.line-itemLoc.end.line,mapLoc.end.column-itemLoc.end.column];if(distance[0]<0||distance[2]<0||distance[0]===0&&distance[1]<0||distance[2]===0&&distance[3]<0)continue;if(nearestContainingItem===null){containerDistance=distance,nearestContainingItem=mapItem,containerKey=i;continue}let closerBefore=distance[0]<containerDistance[0]||distance[0]===0&&distance[1]<containerDistance[1],closerAfter=distance[2]<containerDistance[2]||distance[2]===0&&distance[3]<containerDistance[3];(closerBefore||closerAfter)&&(containerDistance=distance,nearestContainingItem=mapItem,containerKey=i);}return containerKey},addHits=(aHits,bHits)=>typeof aHits=="number"&&typeof bHits=="number"?aHits+bHits:Array.isArray(aHits)&&Array.isArray(bHits)?aHits.map((a,i)=>(a||0)+(bHits[i]||0)):null,addNearestContainerHits=(item,itemHits,map,mapHits)=>{let container=findNearestContainer(item,map);return container?addHits(itemHits,mapHits[container]):itemHits},mergeProp=(aHits,aMap,bHits,bMap,itemKey=keyFromLoc)=>{let aItems={};for(let[key,itemHits]of Object.entries(aHits)){let item=aMap[key];aItems[itemKey(item)]=[itemHits,item];}let bItems={};for(let[key,itemHits]of Object.entries(bHits)){let item=bMap[key];bItems[itemKey(item)]=[itemHits,item];}let mergedItems={};for(let[key,aValue]of Object.entries(aItems)){let aItemHits=aValue[0],aItem=aValue[1],bValue=bItems[key];bValue?aItemHits=addHits(aItemHits,bValue[0]):aItemHits=addNearestContainerHits(aItem,aItemHits,bMap,bHits),mergedItems[key]=[aItemHits,aItem];}for(let[key,bValue]of Object.entries(bItems)){let bItemHits=bValue[0],bItem=bValue[1];mergedItems[key]||(bItemHits=addNearestContainerHits(bItem,bItemHits,aMap,aHits),mergedItems[key]=[bItemHits,bItem]);}let hits={},map={};return Object.values(mergedItems).forEach(([itemHits,item],i)=>{hits[i]=itemHits,map[i]=item;}),[hits,map]},FileCoverage=class _FileCoverage{constructor(pathOrObj,reportLogic=!1){if(!pathOrObj)throw new Error("Coverage must be initialized with a path or an object");if(typeof pathOrObj=="string")this.data=emptyCoverage(pathOrObj,reportLogic);else if(pathOrObj instanceof _FileCoverage)this.data=pathOrObj.data;else if(typeof pathOrObj=="object")this.data=pathOrObj;else throw new Error("Invalid argument to coverage constructor");assertValidObject(this.data);}getLineCoverage(){let statementMap=this.data.statementMap,statements=this.data.s,lineMap=Object.create(null);return Object.entries(statements).forEach(([st,count])=>{if(!statementMap[st])return;let{line}=statementMap[st].start,prevVal=lineMap[line];(prevVal===void 0||prevVal<count)&&(lineMap[line]=count);}),lineMap}getUncoveredLines(){let lc=this.getLineCoverage(),ret=[];return Object.entries(lc).forEach(([l,hits])=>{hits===0&&ret.push(l);}),ret}getBranchCoverageByLine(){let branchMap=this.branchMap,branches=this.b,ret={};return Object.entries(branchMap).forEach(([k,map])=>{let line=map.line||map.loc.start.line,branchData=branches[k];ret[line]=ret[line]||[],ret[line].push(...branchData);}),Object.entries(ret).forEach(([k,dataArray])=>{let covered=dataArray.filter(item=>item>0),coverage=covered.length/dataArray.length*100;ret[k]={covered:covered.length,total:dataArray.length,coverage};}),ret}toJSON(){return this.data}merge(other){if(other.all===!0)return;if(this.all===!0){this.data=other.data;return}let[hits,map]=mergeProp(this.s,this.statementMap,other.s,other.statementMap);this.data.s=hits,this.data.statementMap=map;let keyFromLocProp=x=>keyFromLoc(x.loc),keyFromLocationsProp=x=>keyFromLoc(x.locations[0]);[hits,map]=mergeProp(this.f,this.fnMap,other.f,other.fnMap,keyFromLocProp),this.data.f=hits,this.data.fnMap=map,[hits,map]=mergeProp(this.b,this.branchMap,other.b,other.branchMap,keyFromLocationsProp),this.data.b=hits,this.data.branchMap=map,this.bT&&other.bT&&([hits,map]=mergeProp(this.bT,this.branchMap,other.bT,other.branchMap,keyFromLocationsProp),this.data.bT=hits);}computeSimpleTotals(property){let stats=this[property];typeof stats=="function"&&(stats=stats.call(this));let ret={total:Object.keys(stats).length,covered:Object.values(stats).filter(v=>!!v).length,skipped:0};return ret.pct=percent(ret.covered,ret.total),ret}computeBranchTotals(property){let stats=this[property],ret={total:0,covered:0,skipped:0};return Object.values(stats).forEach(branches=>{ret.covered+=branches.filter(hits=>hits>0).length,ret.total+=branches.length;}),ret.pct=percent(ret.covered,ret.total),ret}resetHits(){let statements=this.s,functions=this.f,branches=this.b,branchesTrue=this.bT;Object.keys(statements).forEach(s=>{statements[s]=0;}),Object.keys(functions).forEach(f=>{functions[f]=0;}),Object.keys(branches).forEach(b=>{branches[b].fill(0);}),branchesTrue&&Object.keys(branchesTrue).forEach(bT=>{branchesTrue[bT].fill(0);});}toSummary(){let ret={};return ret.lines=this.computeSimpleTotals("getLineCoverage"),ret.functions=this.computeSimpleTotals("f","fnMap"),ret.statements=this.computeSimpleTotals("s","statementMap"),ret.branches=this.computeBranchTotals("b"),this.bT&&(ret.branchesTrue=this.computeBranchTotals("bT")),new CoverageSummary(ret)}};dataProperties(FileCoverage,["path","statementMap","fnMap","branchMap","s","f","b","bT","all"]);module.exports={FileCoverage,findNearestContainer,addHits,addNearestContainerHits};}});var require_coverage_map=__commonJS({"../../node_modules/istanbul-lib-coverage/lib/coverage-map.js"(exports,module){var{FileCoverage}=require_file_coverage(),{CoverageSummary}=require_coverage_summary();function maybeConstruct(obj,klass){return obj instanceof klass?obj:new klass(obj)}function loadMap(source){let data=Object.create(null);return source&&Object.entries(source).forEach(([k,cov])=>{data[k]=maybeConstruct(cov,FileCoverage);}),data}var CoverageMap=class _CoverageMap{constructor(obj){obj instanceof _CoverageMap?this.data=obj.data:this.data=loadMap(obj);}merge(obj){let other=maybeConstruct(obj,_CoverageMap);Object.values(other.data).forEach(fc=>{this.addFileCoverage(fc);});}filter(callback){Object.keys(this.data).forEach(k=>{callback(k)||delete this.data[k];});}toJSON(){return this.data}files(){return Object.keys(this.data)}fileCoverageFor(file){let fc=this.data[file];if(!fc)throw new Error(`No file coverage available for: ${file}`);return fc}addFileCoverage(fc){let cov=new FileCoverage(fc),{path}=cov;this.data[path]?this.data[path].merge(cov):this.data[path]=cov;}getCoverageSummary(){let ret=new CoverageSummary;return Object.values(this.data).forEach(fc=>{ret.merge(fc.toSummary());}),ret}};module.exports={CoverageMap};}});var require_istanbul_lib_coverage=__commonJS({"../../node_modules/istanbul-lib-coverage/index.js"(exports,module){var{FileCoverage}=require_file_coverage(),{CoverageMap}=require_coverage_map(),{CoverageSummary}=require_coverage_summary();module.exports={createCoverageSummary(obj){return obj&&obj instanceof CoverageSummary?obj:new CoverageSummary(obj)},createCoverageMap(obj){return obj&&obj instanceof CoverageMap?obj:new CoverageMap(obj)},createFileCoverage(obj){return obj&&obj instanceof FileCoverage?obj:new FileCoverage(obj)}};module.exports.classes={FileCoverage};}});var require_path=__commonJS({"../../node_modules/istanbul-lib-report/lib/path.js"(exports,module){var path=__require("path"),parsePath=path.parse,SEP=path.sep,origParser=parsePath,origSep=SEP;function makeRelativeNormalizedPath(str,sep){let parsed=parsePath(str),root=parsed.root,dir,file=parsed.base,quoted,pos;return sep==="\\"&&(pos=root.indexOf(":\\"),pos>=0&&(root=root.substring(0,pos+2))),dir=parsed.dir.substring(root.length),str===""?[]:(sep!=="/"&&(quoted=new RegExp(sep.replace(/\W/g,"\\$&"),"g"),dir=dir.replace(quoted,"/"),file=file.replace(quoted,"/")),dir!==""?dir=`${dir}/${file}`:dir=file,dir.substring(0,1)==="/"&&(dir=dir.substring(1)),dir=dir.split(/\/+/),dir)}var Path=class _Path{constructor(strOrArray){if(Array.isArray(strOrArray))this.v=strOrArray;else if(typeof strOrArray=="string")this.v=makeRelativeNormalizedPath(strOrArray,SEP);else throw new Error(`Invalid Path argument must be string or array:${strOrArray}`)}toString(){return this.v.join("/")}hasParent(){return this.v.length>0}parent(){if(!this.hasParent())throw new Error("Unable to get parent for 0 elem path");let p=this.v.slice();return p.pop(),new _Path(p)}elements(){return this.v.slice()}name(){return this.v.slice(-1)[0]}contains(other){let i;if(other.length>this.length)return !1;for(i=0;i<other.length;i+=1)if(this.v[i]!==other.v[i])return !1;return !0}ancestorOf(other){return other.contains(this)&&other.length!==this.length}descendantOf(other){return this.contains(other)&&other.length!==this.length}commonPrefixPath(other){let len=this.length>other.length?other.length:this.length,i,ret=[];for(i=0;i<len&&this.v[i]===other.v[i];i+=1)ret.push(this.v[i]);return new _Path(ret)}static compare(a,b){let al=a.length,bl=b.length;if(al<bl)return -1;if(al>bl)return 1;let astr=a.toString(),bstr=b.toString();return astr<bstr?-1:astr>bstr?1:0}};["push","pop","shift","unshift","splice"].forEach(fn=>{Object.defineProperty(Path.prototype,fn,{value(...args){return this.v[fn](...args)}});});Object.defineProperty(Path.prototype,"length",{enumerable:!0,get(){return this.v.length}});module.exports=Path;Path.tester={setParserAndSep(p,sep){parsePath=p,SEP=sep;},reset(){parsePath=origParser,SEP=origSep;}};}});var require_summarizer_factory=__commonJS({"../../node_modules/istanbul-lib-report/lib/summarizer-factory.js"(exports,module){var coverage=require_istanbul_lib_coverage(),Path=require_path(),{BaseNode,BaseTree}=require_tree(),ReportNode=class _ReportNode extends BaseNode{constructor(path,fileCoverage){super(),this.path=path,this.parent=null,this.fileCoverage=fileCoverage,this.children=[];}static createRoot(children){let root=new _ReportNode(new Path([]));return children.forEach(child=>{root.addChild(child);}),root}addChild(child){child.parent=this,this.children.push(child);}asRelative(p){return p.substring(0,1)==="/"?p.substring(1):p}getQualifiedName(){return this.asRelative(this.path.toString())}getRelativeName(){let parent=this.getParent(),myPath=this.path,relPath,i,parentPath=parent?parent.path:new Path([]);if(parentPath.ancestorOf(myPath)){for(relPath=new Path(myPath.elements()),i=0;i<parentPath.length;i+=1)relPath.shift();return this.asRelative(relPath.toString())}return this.asRelative(this.path.toString())}getParent(){return this.parent}getChildren(){return this.children}isSummary(){return !this.fileCoverage}getFileCoverage(){return this.fileCoverage}getCoverageSummary(filesOnly){let cacheProp=`c_${filesOnly?"files":"full"}`,summary;if(Object.prototype.hasOwnProperty.call(this,cacheProp))return this[cacheProp];if(!this.isSummary())summary=this.getFileCoverage().toSummary();else {let count=0;summary=coverage.createCoverageSummary(),this.getChildren().forEach(child=>{filesOnly&&child.isSummary()||(count+=1,summary.merge(child.getCoverageSummary(filesOnly)));}),count===0&&filesOnly&&(summary=null);}return this[cacheProp]=summary,summary}},ReportTree=class extends BaseTree{constructor(root,childPrefix){super(root);let maybePrefix=node=>{childPrefix&&!node.isRoot()&&node.path.unshift(childPrefix);};this.visit({onDetail:maybePrefix,onSummary(node){maybePrefix(node),node.children.sort((a,b)=>{let astr=a.path.toString(),bstr=b.path.toString();return astr<bstr?-1:astr>bstr?1:0});}});}};function findCommonParent(paths){return paths.reduce((common,path)=>common.commonPrefixPath(path),paths[0]||new Path([]))}function findOrCreateParent(parentPath,nodeMap,created=()=>{}){let parent=nodeMap[parentPath.toString()];return parent||(parent=new ReportNode(parentPath),nodeMap[parentPath.toString()]=parent,created(parentPath,parent)),parent}function toDirParents(list){let nodeMap=Object.create(null);return list.forEach(o=>{findOrCreateParent(o.path.parent(),nodeMap).addChild(new ReportNode(o.path,o.fileCoverage));}),Object.values(nodeMap)}function addAllPaths(topPaths,nodeMap,path,node){findOrCreateParent(path.parent(),nodeMap,(parentPath,parent2)=>{parentPath.hasParent()?addAllPaths(topPaths,nodeMap,parentPath,parent2):topPaths.push(parent2);}).addChild(node);}function foldIntoOneDir(node,parent){let{children}=node;return children.length===1&&!children[0].fileCoverage?(children[0].parent=parent,foldIntoOneDir(children[0],parent)):(node.children=children.map(child=>foldIntoOneDir(child,node)),node)}function pkgSummaryPrefix(dirParents,commonParent){if(dirParents.some(dp=>dp.path.length===0))return commonParent.length===0?"root":commonParent.name()}var SummarizerFactory=class{constructor(coverageMap,defaultSummarizer="pkg"){this._coverageMap=coverageMap,this._defaultSummarizer=defaultSummarizer,this._initialList=coverageMap.files().map(filePath=>({filePath,path:new Path(filePath),fileCoverage:coverageMap.fileCoverageFor(filePath)})),this._commonParent=findCommonParent(this._initialList.map(o=>o.path.parent())),this._commonParent.length>0&&this._initialList.forEach(o=>{o.path.splice(0,this._commonParent.length);});}get defaultSummarizer(){return this[this._defaultSummarizer]}get flat(){return this._flat||(this._flat=new ReportTree(ReportNode.createRoot(this._initialList.map(node=>new ReportNode(node.path,node.fileCoverage))))),this._flat}_createPkg(){let dirParents=toDirParents(this._initialList);return dirParents.length===1?new ReportTree(dirParents[0]):new ReportTree(ReportNode.createRoot(dirParents),pkgSummaryPrefix(dirParents,this._commonParent))}get pkg(){return this._pkg||(this._pkg=this._createPkg()),this._pkg}_createNested(){let nodeMap=Object.create(null),topPaths=[];this._initialList.forEach(o=>{let node=new ReportNode(o.path,o.fileCoverage);addAllPaths(topPaths,nodeMap,o.path,node);});let topNodes=topPaths.map(node=>foldIntoOneDir(node));return topNodes.length===1?new ReportTree(topNodes[0]):new ReportTree(ReportNode.createRoot(topNodes))}get nested(){return this._nested||(this._nested=this._createNested()),this._nested}};module.exports=SummarizerFactory;}});var require_context=__commonJS({"../../node_modules/istanbul-lib-report/lib/context.js"(exports,module){var fs=__require("fs"),FileWriter=require_file_writer(),XMLWriter=require_xml_writer(),tree=require_tree(),watermarks=require_watermarks(),SummarizerFactory=require_summarizer_factory();function defaultSourceLookup(path){try{return fs.readFileSync(path,"utf8")}catch(ex){throw new Error(`Unable to lookup source: ${path} (${ex.message})`)}}function normalizeWatermarks(specified={}){return Object.entries(watermarks.getDefault()).forEach(([k,value])=>{let specValue=specified[k];(!Array.isArray(specValue)||specValue.length!==2)&&(specified[k]=value);}),specified}var Context=class{constructor(opts){this.dir=opts.dir||"coverage",this.watermarks=normalizeWatermarks(opts.watermarks),this.sourceFinder=opts.sourceFinder||defaultSourceLookup,this._summarizerFactory=new SummarizerFactory(opts.coverageMap,opts.defaultSummarizer),this.data={};}getWriter(){return this.writer}getSource(filePath){return this.sourceFinder(filePath)}classForPercent(type,value){let watermarks2=this.watermarks[type];return watermarks2?value<watermarks2[0]?"low":value>=watermarks2[1]?"high":"medium":"unknown"}getXMLWriter(contentWriter){return new XMLWriter(contentWriter)}getVisitor(partialVisitor){return new tree.Visitor(partialVisitor)}getTree(name="defaultSummarizer"){return this._summarizerFactory[name]}};Object.defineProperty(Context.prototype,"writer",{enumerable:!0,get(){return this.data.writer||(this.data.writer=new FileWriter(this.dir)),this.data.writer}});module.exports=Context;}});var require_report_base=__commonJS({"../../node_modules/istanbul-lib-report/lib/report-base.js"(exports,module){var _summarizer=Symbol("ReportBase.#summarizer"),ReportBase2=class{constructor(opts={}){this[_summarizer]=opts.summarizer;}execute(context){context.getTree(this[_summarizer]).visit(this,context);}};module.exports=ReportBase2;}});var require_istanbul_lib_report=__commonJS({"../../node_modules/istanbul-lib-report/index.js"(exports,module){var Context=require_context(),watermarks=require_watermarks(),ReportBase2=require_report_base();module.exports={createContext(opts){return new Context(opts)},getDefaultWatermarks(){return watermarks.getDefault()},ReportBase:ReportBase2};}});var import_istanbul_lib_report=__toESM(require_istanbul_lib_report()),StorybookCoverageReporter=class extends import_istanbul_lib_report.ReportBase{#testManager;#coverageOptions;constructor(opts){super(),this.#testManager=opts.testManager,this.#coverageOptions=opts.coverageOptions;}onSummary(node){if(!node.isRoot())return;let rawCoverageSummary=node.getCoverageSummary(!1),percentage=Math.round(rawCoverageSummary.data.statements.pct),[lowWatermark=50,highWatermark=80]=this.#coverageOptions?.watermarks?.statements??[],coverageSummary={percentage,status:percentage<lowWatermark?"negative":percentage<highWatermark?"warning":"positive"};this.#testManager.onCoverageCollected(coverageSummary);}};
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_nt0sybtpwl.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_nt0sybtpwl.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_nt0sybtpwl.createRequire(import.meta.url);
|
|
5
8
|
|
|
6
|
-
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
import {
|
|
13
|
+
require_gte
|
|
14
|
+
} from "../_node-chunks/chunk-EZERIZC2.js";
|
|
15
|
+
import {
|
|
16
|
+
__commonJS,
|
|
17
|
+
__name,
|
|
18
|
+
__require,
|
|
19
|
+
__toESM
|
|
20
|
+
} from "../_node-chunks/chunk-MHHQUJAV.js";
|
|
21
|
+
|
|
22
|
+
// ../../node_modules/istanbul-lib-report/node_modules/make-dir/index.js
|
|
23
|
+
var require_make_dir = __commonJS({
|
|
24
|
+
"../../node_modules/istanbul-lib-report/node_modules/make-dir/index.js"(exports, module) {
|
|
25
|
+
"use strict";
|
|
26
|
+
var fs = __require("fs");
|
|
27
|
+
var path = __require("path");
|
|
28
|
+
var { promisify } = __require("util");
|
|
29
|
+
var semverGte = require_gte();
|
|
30
|
+
var useNativeRecursiveOption = semverGte(process.version, "10.12.0");
|
|
31
|
+
var checkPath = /* @__PURE__ */ __name((pth) => {
|
|
32
|
+
if (process.platform === "win32") {
|
|
33
|
+
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, ""));
|
|
34
|
+
if (pathHasInvalidWinCharacters) {
|
|
35
|
+
const error = new Error(`Path contains invalid characters: ${pth}`);
|
|
36
|
+
error.code = "EINVAL";
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}, "checkPath");
|
|
41
|
+
var processOptions = /* @__PURE__ */ __name((options) => {
|
|
42
|
+
const defaults = {
|
|
43
|
+
mode: 511,
|
|
44
|
+
fs
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
...defaults,
|
|
48
|
+
...options
|
|
49
|
+
};
|
|
50
|
+
}, "processOptions");
|
|
51
|
+
var permissionError = /* @__PURE__ */ __name((pth) => {
|
|
52
|
+
const error = new Error(`operation not permitted, mkdir '${pth}'`);
|
|
53
|
+
error.code = "EPERM";
|
|
54
|
+
error.errno = -4048;
|
|
55
|
+
error.path = pth;
|
|
56
|
+
error.syscall = "mkdir";
|
|
57
|
+
return error;
|
|
58
|
+
}, "permissionError");
|
|
59
|
+
var makeDir = /* @__PURE__ */ __name(async (input, options) => {
|
|
60
|
+
checkPath(input);
|
|
61
|
+
options = processOptions(options);
|
|
62
|
+
const mkdir = promisify(options.fs.mkdir);
|
|
63
|
+
const stat = promisify(options.fs.stat);
|
|
64
|
+
if (useNativeRecursiveOption && options.fs.mkdir === fs.mkdir) {
|
|
65
|
+
const pth = path.resolve(input);
|
|
66
|
+
await mkdir(pth, {
|
|
67
|
+
mode: options.mode,
|
|
68
|
+
recursive: true
|
|
69
|
+
});
|
|
70
|
+
return pth;
|
|
71
|
+
}
|
|
72
|
+
const make = /* @__PURE__ */ __name(async (pth) => {
|
|
73
|
+
try {
|
|
74
|
+
await mkdir(pth, options.mode);
|
|
75
|
+
return pth;
|
|
76
|
+
} catch (error) {
|
|
77
|
+
if (error.code === "EPERM") {
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
80
|
+
if (error.code === "ENOENT") {
|
|
81
|
+
if (path.dirname(pth) === pth) {
|
|
82
|
+
throw permissionError(pth);
|
|
83
|
+
}
|
|
84
|
+
if (error.message.includes("null bytes")) {
|
|
85
|
+
throw error;
|
|
86
|
+
}
|
|
87
|
+
await make(path.dirname(pth));
|
|
88
|
+
return make(pth);
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
const stats = await stat(pth);
|
|
92
|
+
if (!stats.isDirectory()) {
|
|
93
|
+
throw new Error("The path is not a directory");
|
|
94
|
+
}
|
|
95
|
+
} catch {
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
return pth;
|
|
99
|
+
}
|
|
100
|
+
}, "make");
|
|
101
|
+
return make(path.resolve(input));
|
|
102
|
+
}, "makeDir");
|
|
103
|
+
module.exports = makeDir;
|
|
104
|
+
module.exports.sync = (input, options) => {
|
|
105
|
+
checkPath(input);
|
|
106
|
+
options = processOptions(options);
|
|
107
|
+
if (useNativeRecursiveOption && options.fs.mkdirSync === fs.mkdirSync) {
|
|
108
|
+
const pth = path.resolve(input);
|
|
109
|
+
fs.mkdirSync(pth, {
|
|
110
|
+
mode: options.mode,
|
|
111
|
+
recursive: true
|
|
112
|
+
});
|
|
113
|
+
return pth;
|
|
114
|
+
}
|
|
115
|
+
const make = /* @__PURE__ */ __name((pth) => {
|
|
116
|
+
try {
|
|
117
|
+
options.fs.mkdirSync(pth, options.mode);
|
|
118
|
+
} catch (error) {
|
|
119
|
+
if (error.code === "EPERM") {
|
|
120
|
+
throw error;
|
|
121
|
+
}
|
|
122
|
+
if (error.code === "ENOENT") {
|
|
123
|
+
if (path.dirname(pth) === pth) {
|
|
124
|
+
throw permissionError(pth);
|
|
125
|
+
}
|
|
126
|
+
if (error.message.includes("null bytes")) {
|
|
127
|
+
throw error;
|
|
128
|
+
}
|
|
129
|
+
make(path.dirname(pth));
|
|
130
|
+
return make(pth);
|
|
131
|
+
}
|
|
132
|
+
try {
|
|
133
|
+
if (!options.fs.statSync(pth).isDirectory()) {
|
|
134
|
+
throw new Error("The path is not a directory");
|
|
135
|
+
}
|
|
136
|
+
} catch {
|
|
137
|
+
throw error;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return pth;
|
|
141
|
+
}, "make");
|
|
142
|
+
return make(path.resolve(input));
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// ../../node_modules/has-flag/index.js
|
|
148
|
+
var require_has_flag = __commonJS({
|
|
149
|
+
"../../node_modules/has-flag/index.js"(exports, module) {
|
|
150
|
+
"use strict";
|
|
151
|
+
module.exports = (flag, argv = process.argv) => {
|
|
152
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
153
|
+
const position = argv.indexOf(prefix + flag);
|
|
154
|
+
const terminatorPosition = argv.indexOf("--");
|
|
155
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
// ../../node_modules/supports-color/index.js
|
|
161
|
+
var require_supports_color = __commonJS({
|
|
162
|
+
"../../node_modules/supports-color/index.js"(exports, module) {
|
|
163
|
+
"use strict";
|
|
164
|
+
var os = __require("os");
|
|
165
|
+
var tty = __require("tty");
|
|
166
|
+
var hasFlag = require_has_flag();
|
|
167
|
+
var { env } = process;
|
|
168
|
+
var forceColor;
|
|
169
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
170
|
+
forceColor = 0;
|
|
171
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
172
|
+
forceColor = 1;
|
|
173
|
+
}
|
|
174
|
+
if ("FORCE_COLOR" in env) {
|
|
175
|
+
if (env.FORCE_COLOR === "true") {
|
|
176
|
+
forceColor = 1;
|
|
177
|
+
} else if (env.FORCE_COLOR === "false") {
|
|
178
|
+
forceColor = 0;
|
|
179
|
+
} else {
|
|
180
|
+
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
function translateLevel(level) {
|
|
184
|
+
if (level === 0) {
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
return {
|
|
188
|
+
level,
|
|
189
|
+
hasBasic: true,
|
|
190
|
+
has256: level >= 2,
|
|
191
|
+
has16m: level >= 3
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
__name(translateLevel, "translateLevel");
|
|
195
|
+
function supportsColor(haveStream, streamIsTTY) {
|
|
196
|
+
if (forceColor === 0) {
|
|
197
|
+
return 0;
|
|
198
|
+
}
|
|
199
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
200
|
+
return 3;
|
|
201
|
+
}
|
|
202
|
+
if (hasFlag("color=256")) {
|
|
203
|
+
return 2;
|
|
204
|
+
}
|
|
205
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
206
|
+
return 0;
|
|
207
|
+
}
|
|
208
|
+
const min = forceColor || 0;
|
|
209
|
+
if (env.TERM === "dumb") {
|
|
210
|
+
return min;
|
|
211
|
+
}
|
|
212
|
+
if (process.platform === "win32") {
|
|
213
|
+
const osRelease = os.release().split(".");
|
|
214
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
215
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
216
|
+
}
|
|
217
|
+
return 1;
|
|
218
|
+
}
|
|
219
|
+
if ("CI" in env) {
|
|
220
|
+
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
221
|
+
return 1;
|
|
222
|
+
}
|
|
223
|
+
return min;
|
|
224
|
+
}
|
|
225
|
+
if ("TEAMCITY_VERSION" in env) {
|
|
226
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
227
|
+
}
|
|
228
|
+
if (env.COLORTERM === "truecolor") {
|
|
229
|
+
return 3;
|
|
230
|
+
}
|
|
231
|
+
if ("TERM_PROGRAM" in env) {
|
|
232
|
+
const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
233
|
+
switch (env.TERM_PROGRAM) {
|
|
234
|
+
case "iTerm.app":
|
|
235
|
+
return version >= 3 ? 3 : 2;
|
|
236
|
+
case "Apple_Terminal":
|
|
237
|
+
return 2;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
241
|
+
return 2;
|
|
242
|
+
}
|
|
243
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
244
|
+
return 1;
|
|
245
|
+
}
|
|
246
|
+
if ("COLORTERM" in env) {
|
|
247
|
+
return 1;
|
|
248
|
+
}
|
|
249
|
+
return min;
|
|
250
|
+
}
|
|
251
|
+
__name(supportsColor, "supportsColor");
|
|
252
|
+
function getSupportLevel(stream) {
|
|
253
|
+
const level = supportsColor(stream, stream && stream.isTTY);
|
|
254
|
+
return translateLevel(level);
|
|
255
|
+
}
|
|
256
|
+
__name(getSupportLevel, "getSupportLevel");
|
|
257
|
+
module.exports = {
|
|
258
|
+
supportsColor: getSupportLevel,
|
|
259
|
+
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
|
260
|
+
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
// ../../node_modules/istanbul-lib-report/lib/file-writer.js
|
|
266
|
+
var require_file_writer = __commonJS({
|
|
267
|
+
"../../node_modules/istanbul-lib-report/lib/file-writer.js"(exports, module) {
|
|
268
|
+
"use strict";
|
|
269
|
+
var path = __require("path");
|
|
270
|
+
var fs = __require("fs");
|
|
271
|
+
var mkdirp = require_make_dir();
|
|
272
|
+
var supportsColor = require_supports_color();
|
|
273
|
+
var ContentWriter = class {
|
|
274
|
+
static {
|
|
275
|
+
__name(this, "ContentWriter");
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* returns the colorized version of a string. Typically,
|
|
279
|
+
* content writers that write to files will return the
|
|
280
|
+
* same string and ones writing to a tty will wrap it in
|
|
281
|
+
* appropriate escape sequences.
|
|
282
|
+
* @param {String} str the string to colorize
|
|
283
|
+
* @param {String} clazz one of `high`, `medium` or `low`
|
|
284
|
+
* @returns {String} the colorized form of the string
|
|
285
|
+
*/
|
|
286
|
+
colorize(str) {
|
|
287
|
+
return str;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* writes a string appended with a newline to the destination
|
|
291
|
+
* @param {String} str the string to write
|
|
292
|
+
*/
|
|
293
|
+
println(str) {
|
|
294
|
+
this.write(`${str}
|
|
295
|
+
`);
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* closes this content writer. Should be called after all writes are complete.
|
|
299
|
+
*/
|
|
300
|
+
close() {
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
var FileContentWriter = class extends ContentWriter {
|
|
304
|
+
static {
|
|
305
|
+
__name(this, "FileContentWriter");
|
|
306
|
+
}
|
|
307
|
+
constructor(fd) {
|
|
308
|
+
super();
|
|
309
|
+
this.fd = fd;
|
|
310
|
+
}
|
|
311
|
+
write(str) {
|
|
312
|
+
fs.writeSync(this.fd, str);
|
|
313
|
+
}
|
|
314
|
+
close() {
|
|
315
|
+
fs.closeSync(this.fd);
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
var capture = false;
|
|
319
|
+
var output = "";
|
|
320
|
+
var ConsoleWriter = class extends ContentWriter {
|
|
321
|
+
static {
|
|
322
|
+
__name(this, "ConsoleWriter");
|
|
323
|
+
}
|
|
324
|
+
write(str) {
|
|
325
|
+
if (capture) {
|
|
326
|
+
output += str;
|
|
327
|
+
} else {
|
|
328
|
+
process.stdout.write(str);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
colorize(str, clazz) {
|
|
332
|
+
const colors = {
|
|
333
|
+
low: "31;1",
|
|
334
|
+
medium: "33;1",
|
|
335
|
+
high: "32;1"
|
|
336
|
+
};
|
|
337
|
+
if (supportsColor.stdout && colors[clazz]) {
|
|
338
|
+
return `\x1B[${colors[clazz]}m${str}\x1B[0m`;
|
|
339
|
+
}
|
|
340
|
+
return str;
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
var FileWriter = class _FileWriter {
|
|
344
|
+
static {
|
|
345
|
+
__name(this, "FileWriter");
|
|
346
|
+
}
|
|
347
|
+
constructor(baseDir) {
|
|
348
|
+
if (!baseDir) {
|
|
349
|
+
throw new Error("baseDir must be specified");
|
|
350
|
+
}
|
|
351
|
+
this.baseDir = baseDir;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* static helpers for capturing stdout report output;
|
|
355
|
+
* super useful for tests!
|
|
356
|
+
*/
|
|
357
|
+
static startCapture() {
|
|
358
|
+
capture = true;
|
|
359
|
+
}
|
|
360
|
+
static stopCapture() {
|
|
361
|
+
capture = false;
|
|
362
|
+
}
|
|
363
|
+
static getOutput() {
|
|
364
|
+
return output;
|
|
365
|
+
}
|
|
366
|
+
static resetOutput() {
|
|
367
|
+
output = "";
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* returns a FileWriter that is rooted at the supplied subdirectory
|
|
371
|
+
* @param {String} subdir the subdirectory under which to root the
|
|
372
|
+
* returned FileWriter
|
|
373
|
+
* @returns {FileWriter}
|
|
374
|
+
*/
|
|
375
|
+
writerForDir(subdir) {
|
|
376
|
+
if (path.isAbsolute(subdir)) {
|
|
377
|
+
throw new Error(
|
|
378
|
+
`Cannot create subdir writer for absolute path: ${subdir}`
|
|
379
|
+
);
|
|
380
|
+
}
|
|
381
|
+
return new _FileWriter(`${this.baseDir}/${subdir}`);
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* copies a file from a source directory to a destination name
|
|
385
|
+
* @param {String} source path to source file
|
|
386
|
+
* @param {String} dest relative path to destination file
|
|
387
|
+
* @param {String} [header=undefined] optional text to prepend to destination
|
|
388
|
+
* (e.g., an "this file is autogenerated" comment, copyright notice, etc.)
|
|
389
|
+
*/
|
|
390
|
+
copyFile(source, dest, header) {
|
|
391
|
+
if (path.isAbsolute(dest)) {
|
|
392
|
+
throw new Error(`Cannot write to absolute path: ${dest}`);
|
|
393
|
+
}
|
|
394
|
+
dest = path.resolve(this.baseDir, dest);
|
|
395
|
+
mkdirp.sync(path.dirname(dest));
|
|
396
|
+
let contents;
|
|
397
|
+
if (header) {
|
|
398
|
+
contents = header + fs.readFileSync(source, "utf8");
|
|
399
|
+
} else {
|
|
400
|
+
contents = fs.readFileSync(source);
|
|
401
|
+
}
|
|
402
|
+
fs.writeFileSync(dest, contents);
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* returns a content writer for writing content to the supplied file.
|
|
406
|
+
* @param {String|null} file the relative path to the file or the special
|
|
407
|
+
* values `"-"` or `null` for writing to the console
|
|
408
|
+
* @returns {ContentWriter}
|
|
409
|
+
*/
|
|
410
|
+
writeFile(file) {
|
|
411
|
+
if (file === null || file === "-") {
|
|
412
|
+
return new ConsoleWriter();
|
|
413
|
+
}
|
|
414
|
+
if (path.isAbsolute(file)) {
|
|
415
|
+
throw new Error(`Cannot write to absolute path: ${file}`);
|
|
416
|
+
}
|
|
417
|
+
file = path.resolve(this.baseDir, file);
|
|
418
|
+
mkdirp.sync(path.dirname(file));
|
|
419
|
+
return new FileContentWriter(fs.openSync(file, "w"));
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
module.exports = FileWriter;
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
// ../../node_modules/istanbul-lib-report/lib/xml-writer.js
|
|
427
|
+
var require_xml_writer = __commonJS({
|
|
428
|
+
"../../node_modules/istanbul-lib-report/lib/xml-writer.js"(exports, module) {
|
|
429
|
+
"use strict";
|
|
430
|
+
var INDENT = " ";
|
|
431
|
+
function attrString(attrs) {
|
|
432
|
+
return Object.entries(attrs || {}).map(([k, v]) => ` ${k}="${v}"`).join("");
|
|
433
|
+
}
|
|
434
|
+
__name(attrString, "attrString");
|
|
435
|
+
var XMLWriter = class {
|
|
436
|
+
static {
|
|
437
|
+
__name(this, "XMLWriter");
|
|
438
|
+
}
|
|
439
|
+
constructor(contentWriter) {
|
|
440
|
+
this.cw = contentWriter;
|
|
441
|
+
this.stack = [];
|
|
442
|
+
}
|
|
443
|
+
indent(str) {
|
|
444
|
+
return this.stack.map(() => INDENT).join("") + str;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* writes the opening XML tag with the supplied attributes
|
|
448
|
+
* @param {String} name tag name
|
|
449
|
+
* @param {Object} [attrs=null] attrs attributes for the tag
|
|
450
|
+
*/
|
|
451
|
+
openTag(name, attrs) {
|
|
452
|
+
const str = this.indent(`<${name + attrString(attrs)}>`);
|
|
453
|
+
this.cw.println(str);
|
|
454
|
+
this.stack.push(name);
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* closes an open XML tag.
|
|
458
|
+
* @param {String} name - tag name to close. This must match the writer's
|
|
459
|
+
* notion of the tag that is currently open.
|
|
460
|
+
*/
|
|
461
|
+
closeTag(name) {
|
|
462
|
+
if (this.stack.length === 0) {
|
|
463
|
+
throw new Error(`Attempt to close tag ${name} when not opened`);
|
|
464
|
+
}
|
|
465
|
+
const stashed = this.stack.pop();
|
|
466
|
+
const str = `</${name}>`;
|
|
467
|
+
if (stashed !== name) {
|
|
468
|
+
throw new Error(
|
|
469
|
+
`Attempt to close tag ${name} when ${stashed} was the one open`
|
|
470
|
+
);
|
|
471
|
+
}
|
|
472
|
+
this.cw.println(this.indent(str));
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* writes a tag and its value opening and closing it at the same time
|
|
476
|
+
* @param {String} name tag name
|
|
477
|
+
* @param {Object} [attrs=null] attrs tag attributes
|
|
478
|
+
* @param {String} [content=null] content optional tag content
|
|
479
|
+
*/
|
|
480
|
+
inlineTag(name, attrs, content) {
|
|
481
|
+
let str = "<" + name + attrString(attrs);
|
|
482
|
+
if (content) {
|
|
483
|
+
str += `>${content}</${name}>`;
|
|
484
|
+
} else {
|
|
485
|
+
str += "/>";
|
|
486
|
+
}
|
|
487
|
+
str = this.indent(str);
|
|
488
|
+
this.cw.println(str);
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* closes all open tags and ends the document
|
|
492
|
+
*/
|
|
493
|
+
closeAll() {
|
|
494
|
+
this.stack.slice().reverse().forEach((name) => {
|
|
495
|
+
this.closeTag(name);
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
module.exports = XMLWriter;
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
|
|
503
|
+
// ../../node_modules/istanbul-lib-report/lib/tree.js
|
|
504
|
+
var require_tree = __commonJS({
|
|
505
|
+
"../../node_modules/istanbul-lib-report/lib/tree.js"(exports, module) {
|
|
506
|
+
"use strict";
|
|
507
|
+
var Visitor = class {
|
|
508
|
+
static {
|
|
509
|
+
__name(this, "Visitor");
|
|
510
|
+
}
|
|
511
|
+
constructor(delegate) {
|
|
512
|
+
this.delegate = delegate;
|
|
513
|
+
}
|
|
514
|
+
};
|
|
515
|
+
["Start", "End", "Summary", "SummaryEnd", "Detail"].map((k) => `on${k}`).forEach((fn) => {
|
|
516
|
+
Object.defineProperty(Visitor.prototype, fn, {
|
|
517
|
+
writable: true,
|
|
518
|
+
value(node, state) {
|
|
519
|
+
if (typeof this.delegate[fn] === "function") {
|
|
520
|
+
this.delegate[fn](node, state);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
});
|
|
525
|
+
var CompositeVisitor = class extends Visitor {
|
|
526
|
+
static {
|
|
527
|
+
__name(this, "CompositeVisitor");
|
|
528
|
+
}
|
|
529
|
+
constructor(visitors) {
|
|
530
|
+
super();
|
|
531
|
+
if (!Array.isArray(visitors)) {
|
|
532
|
+
visitors = [visitors];
|
|
533
|
+
}
|
|
534
|
+
this.visitors = visitors.map((v) => {
|
|
535
|
+
if (v instanceof Visitor) {
|
|
536
|
+
return v;
|
|
537
|
+
}
|
|
538
|
+
return new Visitor(v);
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
["Start", "Summary", "SummaryEnd", "Detail", "End"].map((k) => `on${k}`).forEach((fn) => {
|
|
543
|
+
Object.defineProperty(CompositeVisitor.prototype, fn, {
|
|
544
|
+
value(node, state) {
|
|
545
|
+
this.visitors.forEach((v) => {
|
|
546
|
+
v[fn](node, state);
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
});
|
|
551
|
+
var BaseNode = class {
|
|
552
|
+
static {
|
|
553
|
+
__name(this, "BaseNode");
|
|
554
|
+
}
|
|
555
|
+
isRoot() {
|
|
556
|
+
return !this.getParent();
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* visit all nodes depth-first from this node down. Note that `onStart`
|
|
560
|
+
* and `onEnd` are never called on the visitor even if the current
|
|
561
|
+
* node is the root of the tree.
|
|
562
|
+
* @param visitor a full visitor that is called during tree traversal
|
|
563
|
+
* @param state optional state that is passed around
|
|
564
|
+
*/
|
|
565
|
+
visit(visitor, state) {
|
|
566
|
+
if (this.isSummary()) {
|
|
567
|
+
visitor.onSummary(this, state);
|
|
568
|
+
} else {
|
|
569
|
+
visitor.onDetail(this, state);
|
|
570
|
+
}
|
|
571
|
+
this.getChildren().forEach((child) => {
|
|
572
|
+
child.visit(visitor, state);
|
|
573
|
+
});
|
|
574
|
+
if (this.isSummary()) {
|
|
575
|
+
visitor.onSummaryEnd(this, state);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
var BaseTree = class {
|
|
580
|
+
static {
|
|
581
|
+
__name(this, "BaseTree");
|
|
582
|
+
}
|
|
583
|
+
constructor(root) {
|
|
584
|
+
this.root = root;
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* returns the root node of the tree
|
|
588
|
+
*/
|
|
589
|
+
getRoot() {
|
|
590
|
+
return this.root;
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* visits the tree depth-first with the supplied partial visitor
|
|
594
|
+
* @param visitor - a potentially partial visitor
|
|
595
|
+
* @param state - the state to be passed around during tree traversal
|
|
596
|
+
*/
|
|
597
|
+
visit(visitor, state) {
|
|
598
|
+
if (!(visitor instanceof Visitor)) {
|
|
599
|
+
visitor = new Visitor(visitor);
|
|
600
|
+
}
|
|
601
|
+
visitor.onStart(this.getRoot(), state);
|
|
602
|
+
this.getRoot().visit(visitor, state);
|
|
603
|
+
visitor.onEnd(this.getRoot(), state);
|
|
604
|
+
}
|
|
605
|
+
};
|
|
606
|
+
module.exports = {
|
|
607
|
+
BaseTree,
|
|
608
|
+
BaseNode,
|
|
609
|
+
Visitor,
|
|
610
|
+
CompositeVisitor
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
});
|
|
614
|
+
|
|
615
|
+
// ../../node_modules/istanbul-lib-report/lib/watermarks.js
|
|
616
|
+
var require_watermarks = __commonJS({
|
|
617
|
+
"../../node_modules/istanbul-lib-report/lib/watermarks.js"(exports, module) {
|
|
618
|
+
"use strict";
|
|
619
|
+
module.exports = {
|
|
620
|
+
getDefault() {
|
|
621
|
+
return {
|
|
622
|
+
statements: [50, 80],
|
|
623
|
+
functions: [50, 80],
|
|
624
|
+
branches: [50, 80],
|
|
625
|
+
lines: [50, 80]
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
});
|
|
631
|
+
|
|
632
|
+
// ../../node_modules/istanbul-lib-coverage/lib/percent.js
|
|
633
|
+
var require_percent = __commonJS({
|
|
634
|
+
"../../node_modules/istanbul-lib-coverage/lib/percent.js"(exports, module) {
|
|
635
|
+
"use strict";
|
|
636
|
+
module.exports = /* @__PURE__ */ __name(function percent(covered, total) {
|
|
637
|
+
let tmp;
|
|
638
|
+
if (total > 0) {
|
|
639
|
+
tmp = 1e3 * 100 * covered / total;
|
|
640
|
+
return Math.floor(tmp / 10) / 100;
|
|
641
|
+
} else {
|
|
642
|
+
return 100;
|
|
643
|
+
}
|
|
644
|
+
}, "percent");
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
|
|
648
|
+
// ../../node_modules/istanbul-lib-coverage/lib/data-properties.js
|
|
649
|
+
var require_data_properties = __commonJS({
|
|
650
|
+
"../../node_modules/istanbul-lib-coverage/lib/data-properties.js"(exports, module) {
|
|
651
|
+
"use strict";
|
|
652
|
+
module.exports = /* @__PURE__ */ __name(function dataProperties(klass, properties) {
|
|
653
|
+
properties.forEach((p) => {
|
|
654
|
+
Object.defineProperty(klass.prototype, p, {
|
|
655
|
+
enumerable: true,
|
|
656
|
+
get() {
|
|
657
|
+
return this.data[p];
|
|
658
|
+
}
|
|
659
|
+
});
|
|
660
|
+
});
|
|
661
|
+
}, "dataProperties");
|
|
662
|
+
}
|
|
663
|
+
});
|
|
664
|
+
|
|
665
|
+
// ../../node_modules/istanbul-lib-coverage/lib/coverage-summary.js
|
|
666
|
+
var require_coverage_summary = __commonJS({
|
|
667
|
+
"../../node_modules/istanbul-lib-coverage/lib/coverage-summary.js"(exports, module) {
|
|
668
|
+
"use strict";
|
|
669
|
+
var percent = require_percent();
|
|
670
|
+
var dataProperties = require_data_properties();
|
|
671
|
+
function blankSummary() {
|
|
672
|
+
const empty = /* @__PURE__ */ __name(() => ({
|
|
673
|
+
total: 0,
|
|
674
|
+
covered: 0,
|
|
675
|
+
skipped: 0,
|
|
676
|
+
pct: "Unknown"
|
|
677
|
+
}), "empty");
|
|
678
|
+
return {
|
|
679
|
+
lines: empty(),
|
|
680
|
+
statements: empty(),
|
|
681
|
+
functions: empty(),
|
|
682
|
+
branches: empty(),
|
|
683
|
+
branchesTrue: empty()
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
__name(blankSummary, "blankSummary");
|
|
687
|
+
function assertValidSummary(obj) {
|
|
688
|
+
const valid = obj && obj.lines && obj.statements && obj.functions && obj.branches;
|
|
689
|
+
if (!valid) {
|
|
690
|
+
throw new Error(
|
|
691
|
+
"Invalid summary coverage object, missing keys, found:" + Object.keys(obj).join(",")
|
|
692
|
+
);
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
__name(assertValidSummary, "assertValidSummary");
|
|
696
|
+
var CoverageSummary = class _CoverageSummary {
|
|
697
|
+
static {
|
|
698
|
+
__name(this, "CoverageSummary");
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* @constructor
|
|
702
|
+
* @param {Object|CoverageSummary} [obj=undefined] an optional data object or
|
|
703
|
+
* another coverage summary to initialize this object with.
|
|
704
|
+
*/
|
|
705
|
+
constructor(obj) {
|
|
706
|
+
if (!obj) {
|
|
707
|
+
this.data = blankSummary();
|
|
708
|
+
} else if (obj instanceof _CoverageSummary) {
|
|
709
|
+
this.data = obj.data;
|
|
710
|
+
} else {
|
|
711
|
+
this.data = obj;
|
|
712
|
+
}
|
|
713
|
+
assertValidSummary(this.data);
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* merges a second summary coverage object into this one
|
|
717
|
+
* @param {CoverageSummary} obj - another coverage summary object
|
|
718
|
+
*/
|
|
719
|
+
merge(obj) {
|
|
720
|
+
const keys = [
|
|
721
|
+
"lines",
|
|
722
|
+
"statements",
|
|
723
|
+
"branches",
|
|
724
|
+
"functions",
|
|
725
|
+
"branchesTrue"
|
|
726
|
+
];
|
|
727
|
+
keys.forEach((key) => {
|
|
728
|
+
if (obj[key]) {
|
|
729
|
+
this[key].total += obj[key].total;
|
|
730
|
+
this[key].covered += obj[key].covered;
|
|
731
|
+
this[key].skipped += obj[key].skipped;
|
|
732
|
+
this[key].pct = percent(this[key].covered, this[key].total);
|
|
733
|
+
}
|
|
734
|
+
});
|
|
735
|
+
return this;
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* returns a POJO that is JSON serializable. May be used to get the raw
|
|
739
|
+
* summary object.
|
|
740
|
+
*/
|
|
741
|
+
toJSON() {
|
|
742
|
+
return this.data;
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* return true if summary has no lines of code
|
|
746
|
+
*/
|
|
747
|
+
isEmpty() {
|
|
748
|
+
return this.lines.total === 0;
|
|
749
|
+
}
|
|
750
|
+
};
|
|
751
|
+
dataProperties(CoverageSummary, [
|
|
752
|
+
"lines",
|
|
753
|
+
"statements",
|
|
754
|
+
"functions",
|
|
755
|
+
"branches",
|
|
756
|
+
"branchesTrue"
|
|
757
|
+
]);
|
|
758
|
+
module.exports = {
|
|
759
|
+
CoverageSummary
|
|
760
|
+
};
|
|
761
|
+
}
|
|
762
|
+
});
|
|
763
|
+
|
|
764
|
+
// ../../node_modules/istanbul-lib-coverage/lib/file-coverage.js
|
|
765
|
+
var require_file_coverage = __commonJS({
|
|
766
|
+
"../../node_modules/istanbul-lib-coverage/lib/file-coverage.js"(exports, module) {
|
|
767
|
+
"use strict";
|
|
768
|
+
var percent = require_percent();
|
|
769
|
+
var dataProperties = require_data_properties();
|
|
770
|
+
var { CoverageSummary } = require_coverage_summary();
|
|
771
|
+
function emptyCoverage(filePath, reportLogic) {
|
|
772
|
+
const cov = {
|
|
773
|
+
path: filePath,
|
|
774
|
+
statementMap: {},
|
|
775
|
+
fnMap: {},
|
|
776
|
+
branchMap: {},
|
|
777
|
+
s: {},
|
|
778
|
+
f: {},
|
|
779
|
+
b: {}
|
|
780
|
+
};
|
|
781
|
+
if (reportLogic) cov.bT = {};
|
|
782
|
+
return cov;
|
|
783
|
+
}
|
|
784
|
+
__name(emptyCoverage, "emptyCoverage");
|
|
785
|
+
function assertValidObject(obj) {
|
|
786
|
+
const valid = obj && obj.path && obj.statementMap && obj.fnMap && obj.branchMap && obj.s && obj.f && obj.b;
|
|
787
|
+
if (!valid) {
|
|
788
|
+
throw new Error(
|
|
789
|
+
"Invalid file coverage object, missing keys, found:" + Object.keys(obj).join(",")
|
|
790
|
+
);
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
__name(assertValidObject, "assertValidObject");
|
|
794
|
+
var keyFromLoc = /* @__PURE__ */ __name(({ start, end }) => `${start.line}|${start.column}|${end.line}|${end.column}`, "keyFromLoc");
|
|
795
|
+
var isObj = /* @__PURE__ */ __name((o) => !!o && typeof o === "object", "isObj");
|
|
796
|
+
var isLineCol = /* @__PURE__ */ __name((o) => isObj(o) && typeof o.line === "number" && typeof o.column === "number", "isLineCol");
|
|
797
|
+
var isLoc = /* @__PURE__ */ __name((o) => isObj(o) && isLineCol(o.start) && isLineCol(o.end), "isLoc");
|
|
798
|
+
var getLoc = /* @__PURE__ */ __name((o) => isLoc(o) ? o : isLoc(o.loc) ? o.loc : null, "getLoc");
|
|
799
|
+
var findNearestContainer = /* @__PURE__ */ __name((item, map) => {
|
|
800
|
+
const itemLoc = getLoc(item);
|
|
801
|
+
if (!itemLoc) return null;
|
|
802
|
+
let nearestContainingItem = null;
|
|
803
|
+
let containerDistance = null;
|
|
804
|
+
let containerKey = null;
|
|
805
|
+
for (const [i, mapItem] of Object.entries(map)) {
|
|
806
|
+
const mapLoc = getLoc(mapItem);
|
|
807
|
+
if (!mapLoc) continue;
|
|
808
|
+
const distance = [
|
|
809
|
+
itemLoc.start.line - mapLoc.start.line,
|
|
810
|
+
itemLoc.start.column - mapLoc.start.column,
|
|
811
|
+
mapLoc.end.line - itemLoc.end.line,
|
|
812
|
+
mapLoc.end.column - itemLoc.end.column
|
|
813
|
+
];
|
|
814
|
+
if (distance[0] < 0 || distance[2] < 0 || distance[0] === 0 && distance[1] < 0 || distance[2] === 0 && distance[3] < 0) {
|
|
815
|
+
continue;
|
|
816
|
+
}
|
|
817
|
+
if (nearestContainingItem === null) {
|
|
818
|
+
containerDistance = distance;
|
|
819
|
+
nearestContainingItem = mapItem;
|
|
820
|
+
containerKey = i;
|
|
821
|
+
continue;
|
|
822
|
+
}
|
|
823
|
+
const closerBefore = distance[0] < containerDistance[0] || distance[0] === 0 && distance[1] < containerDistance[1];
|
|
824
|
+
const closerAfter = distance[2] < containerDistance[2] || distance[2] === 0 && distance[3] < containerDistance[3];
|
|
825
|
+
if (closerBefore || closerAfter) {
|
|
826
|
+
containerDistance = distance;
|
|
827
|
+
nearestContainingItem = mapItem;
|
|
828
|
+
containerKey = i;
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
return containerKey;
|
|
832
|
+
}, "findNearestContainer");
|
|
833
|
+
var addHits = /* @__PURE__ */ __name((aHits, bHits) => {
|
|
834
|
+
if (typeof aHits === "number" && typeof bHits === "number") {
|
|
835
|
+
return aHits + bHits;
|
|
836
|
+
} else if (Array.isArray(aHits) && Array.isArray(bHits)) {
|
|
837
|
+
return aHits.map((a, i) => (a || 0) + (bHits[i] || 0));
|
|
838
|
+
}
|
|
839
|
+
return null;
|
|
840
|
+
}, "addHits");
|
|
841
|
+
var addNearestContainerHits = /* @__PURE__ */ __name((item, itemHits, map, mapHits) => {
|
|
842
|
+
const container = findNearestContainer(item, map);
|
|
843
|
+
if (container) {
|
|
844
|
+
return addHits(itemHits, mapHits[container]);
|
|
845
|
+
} else {
|
|
846
|
+
return itemHits;
|
|
847
|
+
}
|
|
848
|
+
}, "addNearestContainerHits");
|
|
849
|
+
var mergeProp = /* @__PURE__ */ __name((aHits, aMap, bHits, bMap, itemKey = keyFromLoc) => {
|
|
850
|
+
const aItems = {};
|
|
851
|
+
for (const [key, itemHits] of Object.entries(aHits)) {
|
|
852
|
+
const item = aMap[key];
|
|
853
|
+
aItems[itemKey(item)] = [itemHits, item];
|
|
854
|
+
}
|
|
855
|
+
const bItems = {};
|
|
856
|
+
for (const [key, itemHits] of Object.entries(bHits)) {
|
|
857
|
+
const item = bMap[key];
|
|
858
|
+
bItems[itemKey(item)] = [itemHits, item];
|
|
859
|
+
}
|
|
860
|
+
const mergedItems = {};
|
|
861
|
+
for (const [key, aValue] of Object.entries(aItems)) {
|
|
862
|
+
let aItemHits = aValue[0];
|
|
863
|
+
const aItem = aValue[1];
|
|
864
|
+
const bValue = bItems[key];
|
|
865
|
+
if (!bValue) {
|
|
866
|
+
aItemHits = addNearestContainerHits(aItem, aItemHits, bMap, bHits);
|
|
867
|
+
} else {
|
|
868
|
+
aItemHits = addHits(aItemHits, bValue[0]);
|
|
869
|
+
}
|
|
870
|
+
mergedItems[key] = [aItemHits, aItem];
|
|
871
|
+
}
|
|
872
|
+
for (const [key, bValue] of Object.entries(bItems)) {
|
|
873
|
+
let bItemHits = bValue[0];
|
|
874
|
+
const bItem = bValue[1];
|
|
875
|
+
if (mergedItems[key]) continue;
|
|
876
|
+
bItemHits = addNearestContainerHits(bItem, bItemHits, aMap, aHits);
|
|
877
|
+
mergedItems[key] = [bItemHits, bItem];
|
|
878
|
+
}
|
|
879
|
+
const hits = {};
|
|
880
|
+
const map = {};
|
|
881
|
+
Object.values(mergedItems).forEach(([itemHits, item], i) => {
|
|
882
|
+
hits[i] = itemHits;
|
|
883
|
+
map[i] = item;
|
|
884
|
+
});
|
|
885
|
+
return [hits, map];
|
|
886
|
+
}, "mergeProp");
|
|
887
|
+
var FileCoverage = class _FileCoverage {
|
|
888
|
+
static {
|
|
889
|
+
__name(this, "FileCoverage");
|
|
890
|
+
}
|
|
891
|
+
/**
|
|
892
|
+
* @constructor
|
|
893
|
+
* @param {Object|FileCoverage|String} pathOrObj is a string that initializes
|
|
894
|
+
* and empty coverage object with the specified file path or a data object that
|
|
895
|
+
* has all the required properties for a file coverage object.
|
|
896
|
+
*/
|
|
897
|
+
constructor(pathOrObj, reportLogic = false) {
|
|
898
|
+
if (!pathOrObj) {
|
|
899
|
+
throw new Error(
|
|
900
|
+
"Coverage must be initialized with a path or an object"
|
|
901
|
+
);
|
|
902
|
+
}
|
|
903
|
+
if (typeof pathOrObj === "string") {
|
|
904
|
+
this.data = emptyCoverage(pathOrObj, reportLogic);
|
|
905
|
+
} else if (pathOrObj instanceof _FileCoverage) {
|
|
906
|
+
this.data = pathOrObj.data;
|
|
907
|
+
} else if (typeof pathOrObj === "object") {
|
|
908
|
+
this.data = pathOrObj;
|
|
909
|
+
} else {
|
|
910
|
+
throw new Error("Invalid argument to coverage constructor");
|
|
911
|
+
}
|
|
912
|
+
assertValidObject(this.data);
|
|
913
|
+
}
|
|
914
|
+
/**
|
|
915
|
+
* returns computed line coverage from statement coverage.
|
|
916
|
+
* This is a map of hits keyed by line number in the source.
|
|
917
|
+
*/
|
|
918
|
+
getLineCoverage() {
|
|
919
|
+
const statementMap = this.data.statementMap;
|
|
920
|
+
const statements = this.data.s;
|
|
921
|
+
const lineMap = /* @__PURE__ */ Object.create(null);
|
|
922
|
+
Object.entries(statements).forEach(([st, count]) => {
|
|
923
|
+
if (!statementMap[st]) {
|
|
924
|
+
return;
|
|
925
|
+
}
|
|
926
|
+
const { line } = statementMap[st].start;
|
|
927
|
+
const prevVal = lineMap[line];
|
|
928
|
+
if (prevVal === void 0 || prevVal < count) {
|
|
929
|
+
lineMap[line] = count;
|
|
930
|
+
}
|
|
931
|
+
});
|
|
932
|
+
return lineMap;
|
|
933
|
+
}
|
|
934
|
+
/**
|
|
935
|
+
* returns an array of uncovered line numbers.
|
|
936
|
+
* @returns {Array} an array of line numbers for which no hits have been
|
|
937
|
+
* collected.
|
|
938
|
+
*/
|
|
939
|
+
getUncoveredLines() {
|
|
940
|
+
const lc = this.getLineCoverage();
|
|
941
|
+
const ret = [];
|
|
942
|
+
Object.entries(lc).forEach(([l, hits]) => {
|
|
943
|
+
if (hits === 0) {
|
|
944
|
+
ret.push(l);
|
|
945
|
+
}
|
|
946
|
+
});
|
|
947
|
+
return ret;
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* returns a map of branch coverage by source line number.
|
|
951
|
+
* @returns {Object} an object keyed by line number. Each object
|
|
952
|
+
* has a `covered`, `total` and `coverage` (percentage) property.
|
|
953
|
+
*/
|
|
954
|
+
getBranchCoverageByLine() {
|
|
955
|
+
const branchMap = this.branchMap;
|
|
956
|
+
const branches = this.b;
|
|
957
|
+
const ret = {};
|
|
958
|
+
Object.entries(branchMap).forEach(([k, map]) => {
|
|
959
|
+
const line = map.line || map.loc.start.line;
|
|
960
|
+
const branchData = branches[k];
|
|
961
|
+
ret[line] = ret[line] || [];
|
|
962
|
+
ret[line].push(...branchData);
|
|
963
|
+
});
|
|
964
|
+
Object.entries(ret).forEach(([k, dataArray]) => {
|
|
965
|
+
const covered = dataArray.filter((item) => item > 0);
|
|
966
|
+
const coverage = covered.length / dataArray.length * 100;
|
|
967
|
+
ret[k] = {
|
|
968
|
+
covered: covered.length,
|
|
969
|
+
total: dataArray.length,
|
|
970
|
+
coverage
|
|
971
|
+
};
|
|
972
|
+
});
|
|
973
|
+
return ret;
|
|
974
|
+
}
|
|
975
|
+
/**
|
|
976
|
+
* return a JSON-serializable POJO for this file coverage object
|
|
977
|
+
*/
|
|
978
|
+
toJSON() {
|
|
979
|
+
return this.data;
|
|
980
|
+
}
|
|
981
|
+
/**
|
|
982
|
+
* merges a second coverage object into this one, updating hit counts
|
|
983
|
+
* @param {FileCoverage} other - the coverage object to be merged into this one.
|
|
984
|
+
* Note that the other object should have the same structure as this one (same file).
|
|
985
|
+
*/
|
|
986
|
+
merge(other) {
|
|
987
|
+
if (other.all === true) {
|
|
988
|
+
return;
|
|
989
|
+
}
|
|
990
|
+
if (this.all === true) {
|
|
991
|
+
this.data = other.data;
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
994
|
+
let [hits, map] = mergeProp(
|
|
995
|
+
this.s,
|
|
996
|
+
this.statementMap,
|
|
997
|
+
other.s,
|
|
998
|
+
other.statementMap
|
|
999
|
+
);
|
|
1000
|
+
this.data.s = hits;
|
|
1001
|
+
this.data.statementMap = map;
|
|
1002
|
+
const keyFromLocProp = /* @__PURE__ */ __name((x) => keyFromLoc(x.loc), "keyFromLocProp");
|
|
1003
|
+
const keyFromLocationsProp = /* @__PURE__ */ __name((x) => keyFromLoc(x.locations[0]), "keyFromLocationsProp");
|
|
1004
|
+
[hits, map] = mergeProp(
|
|
1005
|
+
this.f,
|
|
1006
|
+
this.fnMap,
|
|
1007
|
+
other.f,
|
|
1008
|
+
other.fnMap,
|
|
1009
|
+
keyFromLocProp
|
|
1010
|
+
);
|
|
1011
|
+
this.data.f = hits;
|
|
1012
|
+
this.data.fnMap = map;
|
|
1013
|
+
[hits, map] = mergeProp(
|
|
1014
|
+
this.b,
|
|
1015
|
+
this.branchMap,
|
|
1016
|
+
other.b,
|
|
1017
|
+
other.branchMap,
|
|
1018
|
+
keyFromLocationsProp
|
|
1019
|
+
);
|
|
1020
|
+
this.data.b = hits;
|
|
1021
|
+
this.data.branchMap = map;
|
|
1022
|
+
if (this.bT && other.bT) {
|
|
1023
|
+
[hits, map] = mergeProp(
|
|
1024
|
+
this.bT,
|
|
1025
|
+
this.branchMap,
|
|
1026
|
+
other.bT,
|
|
1027
|
+
other.branchMap,
|
|
1028
|
+
keyFromLocationsProp
|
|
1029
|
+
);
|
|
1030
|
+
this.data.bT = hits;
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
computeSimpleTotals(property) {
|
|
1034
|
+
let stats = this[property];
|
|
1035
|
+
if (typeof stats === "function") {
|
|
1036
|
+
stats = stats.call(this);
|
|
1037
|
+
}
|
|
1038
|
+
const ret = {
|
|
1039
|
+
total: Object.keys(stats).length,
|
|
1040
|
+
covered: Object.values(stats).filter((v) => !!v).length,
|
|
1041
|
+
skipped: 0
|
|
1042
|
+
};
|
|
1043
|
+
ret.pct = percent(ret.covered, ret.total);
|
|
1044
|
+
return ret;
|
|
1045
|
+
}
|
|
1046
|
+
computeBranchTotals(property) {
|
|
1047
|
+
const stats = this[property];
|
|
1048
|
+
const ret = { total: 0, covered: 0, skipped: 0 };
|
|
1049
|
+
Object.values(stats).forEach((branches) => {
|
|
1050
|
+
ret.covered += branches.filter((hits) => hits > 0).length;
|
|
1051
|
+
ret.total += branches.length;
|
|
1052
|
+
});
|
|
1053
|
+
ret.pct = percent(ret.covered, ret.total);
|
|
1054
|
+
return ret;
|
|
1055
|
+
}
|
|
1056
|
+
/**
|
|
1057
|
+
* resets hit counts for all statements, functions and branches
|
|
1058
|
+
* in this coverage object resulting in zero coverage.
|
|
1059
|
+
*/
|
|
1060
|
+
resetHits() {
|
|
1061
|
+
const statements = this.s;
|
|
1062
|
+
const functions = this.f;
|
|
1063
|
+
const branches = this.b;
|
|
1064
|
+
const branchesTrue = this.bT;
|
|
1065
|
+
Object.keys(statements).forEach((s) => {
|
|
1066
|
+
statements[s] = 0;
|
|
1067
|
+
});
|
|
1068
|
+
Object.keys(functions).forEach((f) => {
|
|
1069
|
+
functions[f] = 0;
|
|
1070
|
+
});
|
|
1071
|
+
Object.keys(branches).forEach((b) => {
|
|
1072
|
+
branches[b].fill(0);
|
|
1073
|
+
});
|
|
1074
|
+
if (branchesTrue) {
|
|
1075
|
+
Object.keys(branchesTrue).forEach((bT) => {
|
|
1076
|
+
branchesTrue[bT].fill(0);
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* returns a CoverageSummary for this file coverage object
|
|
1082
|
+
* @returns {CoverageSummary}
|
|
1083
|
+
*/
|
|
1084
|
+
toSummary() {
|
|
1085
|
+
const ret = {};
|
|
1086
|
+
ret.lines = this.computeSimpleTotals("getLineCoverage");
|
|
1087
|
+
ret.functions = this.computeSimpleTotals("f", "fnMap");
|
|
1088
|
+
ret.statements = this.computeSimpleTotals("s", "statementMap");
|
|
1089
|
+
ret.branches = this.computeBranchTotals("b");
|
|
1090
|
+
if (this.bT) {
|
|
1091
|
+
ret.branchesTrue = this.computeBranchTotals("bT");
|
|
1092
|
+
}
|
|
1093
|
+
return new CoverageSummary(ret);
|
|
1094
|
+
}
|
|
1095
|
+
};
|
|
1096
|
+
dataProperties(FileCoverage, [
|
|
1097
|
+
"path",
|
|
1098
|
+
"statementMap",
|
|
1099
|
+
"fnMap",
|
|
1100
|
+
"branchMap",
|
|
1101
|
+
"s",
|
|
1102
|
+
"f",
|
|
1103
|
+
"b",
|
|
1104
|
+
"bT",
|
|
1105
|
+
"all"
|
|
1106
|
+
]);
|
|
1107
|
+
module.exports = {
|
|
1108
|
+
FileCoverage,
|
|
1109
|
+
// exported for testing
|
|
1110
|
+
findNearestContainer,
|
|
1111
|
+
addHits,
|
|
1112
|
+
addNearestContainerHits
|
|
1113
|
+
};
|
|
1114
|
+
}
|
|
1115
|
+
});
|
|
1116
|
+
|
|
1117
|
+
// ../../node_modules/istanbul-lib-coverage/lib/coverage-map.js
|
|
1118
|
+
var require_coverage_map = __commonJS({
|
|
1119
|
+
"../../node_modules/istanbul-lib-coverage/lib/coverage-map.js"(exports, module) {
|
|
1120
|
+
"use strict";
|
|
1121
|
+
var { FileCoverage } = require_file_coverage();
|
|
1122
|
+
var { CoverageSummary } = require_coverage_summary();
|
|
1123
|
+
function maybeConstruct(obj, klass) {
|
|
1124
|
+
if (obj instanceof klass) {
|
|
1125
|
+
return obj;
|
|
1126
|
+
}
|
|
1127
|
+
return new klass(obj);
|
|
1128
|
+
}
|
|
1129
|
+
__name(maybeConstruct, "maybeConstruct");
|
|
1130
|
+
function loadMap(source) {
|
|
1131
|
+
const data = /* @__PURE__ */ Object.create(null);
|
|
1132
|
+
if (!source) {
|
|
1133
|
+
return data;
|
|
1134
|
+
}
|
|
1135
|
+
Object.entries(source).forEach(([k, cov]) => {
|
|
1136
|
+
data[k] = maybeConstruct(cov, FileCoverage);
|
|
1137
|
+
});
|
|
1138
|
+
return data;
|
|
1139
|
+
}
|
|
1140
|
+
__name(loadMap, "loadMap");
|
|
1141
|
+
var CoverageMap = class _CoverageMap {
|
|
1142
|
+
static {
|
|
1143
|
+
__name(this, "CoverageMap");
|
|
1144
|
+
}
|
|
1145
|
+
/**
|
|
1146
|
+
* @constructor
|
|
1147
|
+
* @param {Object} [obj=undefined] obj A coverage map from which to initialize this
|
|
1148
|
+
* map's contents. This can be the raw global coverage object.
|
|
1149
|
+
*/
|
|
1150
|
+
constructor(obj) {
|
|
1151
|
+
if (obj instanceof _CoverageMap) {
|
|
1152
|
+
this.data = obj.data;
|
|
1153
|
+
} else {
|
|
1154
|
+
this.data = loadMap(obj);
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
/**
|
|
1158
|
+
* merges a second coverage map into this one
|
|
1159
|
+
* @param {CoverageMap} obj - a CoverageMap or its raw data. Coverage is merged
|
|
1160
|
+
* correctly for the same files and additional file coverage keys are created
|
|
1161
|
+
* as needed.
|
|
1162
|
+
*/
|
|
1163
|
+
merge(obj) {
|
|
1164
|
+
const other = maybeConstruct(obj, _CoverageMap);
|
|
1165
|
+
Object.values(other.data).forEach((fc) => {
|
|
1166
|
+
this.addFileCoverage(fc);
|
|
1167
|
+
});
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* filter the coveragemap based on the callback provided
|
|
1171
|
+
* @param {Function (filename)} callback - Returns true if the path
|
|
1172
|
+
* should be included in the coveragemap. False if it should be
|
|
1173
|
+
* removed.
|
|
1174
|
+
*/
|
|
1175
|
+
filter(callback) {
|
|
1176
|
+
Object.keys(this.data).forEach((k) => {
|
|
1177
|
+
if (!callback(k)) {
|
|
1178
|
+
delete this.data[k];
|
|
1179
|
+
}
|
|
1180
|
+
});
|
|
1181
|
+
}
|
|
1182
|
+
/**
|
|
1183
|
+
* returns a JSON-serializable POJO for this coverage map
|
|
1184
|
+
* @returns {Object}
|
|
1185
|
+
*/
|
|
1186
|
+
toJSON() {
|
|
1187
|
+
return this.data;
|
|
1188
|
+
}
|
|
1189
|
+
/**
|
|
1190
|
+
* returns an array for file paths for which this map has coverage
|
|
1191
|
+
* @returns {Array{string}} - array of files
|
|
1192
|
+
*/
|
|
1193
|
+
files() {
|
|
1194
|
+
return Object.keys(this.data);
|
|
1195
|
+
}
|
|
1196
|
+
/**
|
|
1197
|
+
* returns the file coverage for the specified file.
|
|
1198
|
+
* @param {String} file
|
|
1199
|
+
* @returns {FileCoverage}
|
|
1200
|
+
*/
|
|
1201
|
+
fileCoverageFor(file) {
|
|
1202
|
+
const fc = this.data[file];
|
|
1203
|
+
if (!fc) {
|
|
1204
|
+
throw new Error(`No file coverage available for: ${file}`);
|
|
1205
|
+
}
|
|
1206
|
+
return fc;
|
|
1207
|
+
}
|
|
1208
|
+
/**
|
|
1209
|
+
* adds a file coverage object to this map. If the path for the object,
|
|
1210
|
+
* already exists in the map, it is merged with the existing coverage
|
|
1211
|
+
* otherwise a new key is added to the map.
|
|
1212
|
+
* @param {FileCoverage} fc the file coverage to add
|
|
1213
|
+
*/
|
|
1214
|
+
addFileCoverage(fc) {
|
|
1215
|
+
const cov = new FileCoverage(fc);
|
|
1216
|
+
const { path } = cov;
|
|
1217
|
+
if (this.data[path]) {
|
|
1218
|
+
this.data[path].merge(cov);
|
|
1219
|
+
} else {
|
|
1220
|
+
this.data[path] = cov;
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
/**
|
|
1224
|
+
* returns the coverage summary for all the file coverage objects in this map.
|
|
1225
|
+
* @returns {CoverageSummary}
|
|
1226
|
+
*/
|
|
1227
|
+
getCoverageSummary() {
|
|
1228
|
+
const ret = new CoverageSummary();
|
|
1229
|
+
Object.values(this.data).forEach((fc) => {
|
|
1230
|
+
ret.merge(fc.toSummary());
|
|
1231
|
+
});
|
|
1232
|
+
return ret;
|
|
1233
|
+
}
|
|
1234
|
+
};
|
|
1235
|
+
module.exports = {
|
|
1236
|
+
CoverageMap
|
|
1237
|
+
};
|
|
1238
|
+
}
|
|
1239
|
+
});
|
|
1240
|
+
|
|
1241
|
+
// ../../node_modules/istanbul-lib-coverage/index.js
|
|
1242
|
+
var require_istanbul_lib_coverage = __commonJS({
|
|
1243
|
+
"../../node_modules/istanbul-lib-coverage/index.js"(exports, module) {
|
|
1244
|
+
"use strict";
|
|
1245
|
+
var { FileCoverage } = require_file_coverage();
|
|
1246
|
+
var { CoverageMap } = require_coverage_map();
|
|
1247
|
+
var { CoverageSummary } = require_coverage_summary();
|
|
1248
|
+
module.exports = {
|
|
1249
|
+
/**
|
|
1250
|
+
* creates a coverage summary object
|
|
1251
|
+
* @param {Object} obj an argument with the same semantics
|
|
1252
|
+
* as the one passed to the `CoverageSummary` constructor
|
|
1253
|
+
* @returns {CoverageSummary}
|
|
1254
|
+
*/
|
|
1255
|
+
createCoverageSummary(obj) {
|
|
1256
|
+
if (obj && obj instanceof CoverageSummary) {
|
|
1257
|
+
return obj;
|
|
1258
|
+
}
|
|
1259
|
+
return new CoverageSummary(obj);
|
|
1260
|
+
},
|
|
1261
|
+
/**
|
|
1262
|
+
* creates a CoverageMap object
|
|
1263
|
+
* @param {Object} obj optional - an argument with the same semantics
|
|
1264
|
+
* as the one passed to the CoverageMap constructor.
|
|
1265
|
+
* @returns {CoverageMap}
|
|
1266
|
+
*/
|
|
1267
|
+
createCoverageMap(obj) {
|
|
1268
|
+
if (obj && obj instanceof CoverageMap) {
|
|
1269
|
+
return obj;
|
|
1270
|
+
}
|
|
1271
|
+
return new CoverageMap(obj);
|
|
1272
|
+
},
|
|
1273
|
+
/**
|
|
1274
|
+
* creates a FileCoverage object
|
|
1275
|
+
* @param {Object} obj optional - an argument with the same semantics
|
|
1276
|
+
* as the one passed to the FileCoverage constructor.
|
|
1277
|
+
* @returns {FileCoverage}
|
|
1278
|
+
*/
|
|
1279
|
+
createFileCoverage(obj) {
|
|
1280
|
+
if (obj && obj instanceof FileCoverage) {
|
|
1281
|
+
return obj;
|
|
1282
|
+
}
|
|
1283
|
+
return new FileCoverage(obj);
|
|
1284
|
+
}
|
|
1285
|
+
};
|
|
1286
|
+
module.exports.classes = {
|
|
1287
|
+
/**
|
|
1288
|
+
* the file coverage constructor
|
|
1289
|
+
*/
|
|
1290
|
+
FileCoverage
|
|
1291
|
+
};
|
|
1292
|
+
}
|
|
1293
|
+
});
|
|
1294
|
+
|
|
1295
|
+
// ../../node_modules/istanbul-lib-report/lib/path.js
|
|
1296
|
+
var require_path = __commonJS({
|
|
1297
|
+
"../../node_modules/istanbul-lib-report/lib/path.js"(exports, module) {
|
|
1298
|
+
"use strict";
|
|
1299
|
+
var path = __require("path");
|
|
1300
|
+
var parsePath = path.parse;
|
|
1301
|
+
var SEP = path.sep;
|
|
1302
|
+
var origParser = parsePath;
|
|
1303
|
+
var origSep = SEP;
|
|
1304
|
+
function makeRelativeNormalizedPath(str, sep) {
|
|
1305
|
+
const parsed = parsePath(str);
|
|
1306
|
+
let root = parsed.root;
|
|
1307
|
+
let dir;
|
|
1308
|
+
let file = parsed.base;
|
|
1309
|
+
let quoted;
|
|
1310
|
+
let pos;
|
|
1311
|
+
if (sep === "\\") {
|
|
1312
|
+
pos = root.indexOf(":\\");
|
|
1313
|
+
if (pos >= 0) {
|
|
1314
|
+
root = root.substring(0, pos + 2);
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
dir = parsed.dir.substring(root.length);
|
|
1318
|
+
if (str === "") {
|
|
1319
|
+
return [];
|
|
1320
|
+
}
|
|
1321
|
+
if (sep !== "/") {
|
|
1322
|
+
quoted = new RegExp(sep.replace(/\W/g, "\\$&"), "g");
|
|
1323
|
+
dir = dir.replace(quoted, "/");
|
|
1324
|
+
file = file.replace(quoted, "/");
|
|
1325
|
+
}
|
|
1326
|
+
if (dir !== "") {
|
|
1327
|
+
dir = `${dir}/${file}`;
|
|
1328
|
+
} else {
|
|
1329
|
+
dir = file;
|
|
1330
|
+
}
|
|
1331
|
+
if (dir.substring(0, 1) === "/") {
|
|
1332
|
+
dir = dir.substring(1);
|
|
1333
|
+
}
|
|
1334
|
+
dir = dir.split(/\/+/);
|
|
1335
|
+
return dir;
|
|
1336
|
+
}
|
|
1337
|
+
__name(makeRelativeNormalizedPath, "makeRelativeNormalizedPath");
|
|
1338
|
+
var Path = class _Path {
|
|
1339
|
+
static {
|
|
1340
|
+
__name(this, "Path");
|
|
1341
|
+
}
|
|
1342
|
+
constructor(strOrArray) {
|
|
1343
|
+
if (Array.isArray(strOrArray)) {
|
|
1344
|
+
this.v = strOrArray;
|
|
1345
|
+
} else if (typeof strOrArray === "string") {
|
|
1346
|
+
this.v = makeRelativeNormalizedPath(strOrArray, SEP);
|
|
1347
|
+
} else {
|
|
1348
|
+
throw new Error(
|
|
1349
|
+
`Invalid Path argument must be string or array:${strOrArray}`
|
|
1350
|
+
);
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
toString() {
|
|
1354
|
+
return this.v.join("/");
|
|
1355
|
+
}
|
|
1356
|
+
hasParent() {
|
|
1357
|
+
return this.v.length > 0;
|
|
1358
|
+
}
|
|
1359
|
+
parent() {
|
|
1360
|
+
if (!this.hasParent()) {
|
|
1361
|
+
throw new Error("Unable to get parent for 0 elem path");
|
|
1362
|
+
}
|
|
1363
|
+
const p = this.v.slice();
|
|
1364
|
+
p.pop();
|
|
1365
|
+
return new _Path(p);
|
|
1366
|
+
}
|
|
1367
|
+
elements() {
|
|
1368
|
+
return this.v.slice();
|
|
1369
|
+
}
|
|
1370
|
+
name() {
|
|
1371
|
+
return this.v.slice(-1)[0];
|
|
1372
|
+
}
|
|
1373
|
+
contains(other) {
|
|
1374
|
+
let i;
|
|
1375
|
+
if (other.length > this.length) {
|
|
1376
|
+
return false;
|
|
1377
|
+
}
|
|
1378
|
+
for (i = 0; i < other.length; i += 1) {
|
|
1379
|
+
if (this.v[i] !== other.v[i]) {
|
|
1380
|
+
return false;
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
return true;
|
|
1384
|
+
}
|
|
1385
|
+
ancestorOf(other) {
|
|
1386
|
+
return other.contains(this) && other.length !== this.length;
|
|
1387
|
+
}
|
|
1388
|
+
descendantOf(other) {
|
|
1389
|
+
return this.contains(other) && other.length !== this.length;
|
|
1390
|
+
}
|
|
1391
|
+
commonPrefixPath(other) {
|
|
1392
|
+
const len = this.length > other.length ? other.length : this.length;
|
|
1393
|
+
let i;
|
|
1394
|
+
const ret = [];
|
|
1395
|
+
for (i = 0; i < len; i += 1) {
|
|
1396
|
+
if (this.v[i] === other.v[i]) {
|
|
1397
|
+
ret.push(this.v[i]);
|
|
1398
|
+
} else {
|
|
1399
|
+
break;
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
return new _Path(ret);
|
|
1403
|
+
}
|
|
1404
|
+
static compare(a, b) {
|
|
1405
|
+
const al = a.length;
|
|
1406
|
+
const bl = b.length;
|
|
1407
|
+
if (al < bl) {
|
|
1408
|
+
return -1;
|
|
1409
|
+
}
|
|
1410
|
+
if (al > bl) {
|
|
1411
|
+
return 1;
|
|
1412
|
+
}
|
|
1413
|
+
const astr = a.toString();
|
|
1414
|
+
const bstr = b.toString();
|
|
1415
|
+
return astr < bstr ? -1 : astr > bstr ? 1 : 0;
|
|
1416
|
+
}
|
|
1417
|
+
};
|
|
1418
|
+
["push", "pop", "shift", "unshift", "splice"].forEach((fn) => {
|
|
1419
|
+
Object.defineProperty(Path.prototype, fn, {
|
|
1420
|
+
value(...args) {
|
|
1421
|
+
return this.v[fn](...args);
|
|
1422
|
+
}
|
|
1423
|
+
});
|
|
1424
|
+
});
|
|
1425
|
+
Object.defineProperty(Path.prototype, "length", {
|
|
1426
|
+
enumerable: true,
|
|
1427
|
+
get() {
|
|
1428
|
+
return this.v.length;
|
|
1429
|
+
}
|
|
1430
|
+
});
|
|
1431
|
+
module.exports = Path;
|
|
1432
|
+
Path.tester = {
|
|
1433
|
+
setParserAndSep(p, sep) {
|
|
1434
|
+
parsePath = p;
|
|
1435
|
+
SEP = sep;
|
|
1436
|
+
},
|
|
1437
|
+
reset() {
|
|
1438
|
+
parsePath = origParser;
|
|
1439
|
+
SEP = origSep;
|
|
1440
|
+
}
|
|
1441
|
+
};
|
|
1442
|
+
}
|
|
1443
|
+
});
|
|
1444
|
+
|
|
1445
|
+
// ../../node_modules/istanbul-lib-report/lib/summarizer-factory.js
|
|
1446
|
+
var require_summarizer_factory = __commonJS({
|
|
1447
|
+
"../../node_modules/istanbul-lib-report/lib/summarizer-factory.js"(exports, module) {
|
|
1448
|
+
"use strict";
|
|
1449
|
+
var coverage = require_istanbul_lib_coverage();
|
|
1450
|
+
var Path = require_path();
|
|
1451
|
+
var { BaseNode, BaseTree } = require_tree();
|
|
1452
|
+
var ReportNode = class _ReportNode extends BaseNode {
|
|
1453
|
+
static {
|
|
1454
|
+
__name(this, "ReportNode");
|
|
1455
|
+
}
|
|
1456
|
+
constructor(path, fileCoverage) {
|
|
1457
|
+
super();
|
|
1458
|
+
this.path = path;
|
|
1459
|
+
this.parent = null;
|
|
1460
|
+
this.fileCoverage = fileCoverage;
|
|
1461
|
+
this.children = [];
|
|
1462
|
+
}
|
|
1463
|
+
static createRoot(children) {
|
|
1464
|
+
const root = new _ReportNode(new Path([]));
|
|
1465
|
+
children.forEach((child) => {
|
|
1466
|
+
root.addChild(child);
|
|
1467
|
+
});
|
|
1468
|
+
return root;
|
|
1469
|
+
}
|
|
1470
|
+
addChild(child) {
|
|
1471
|
+
child.parent = this;
|
|
1472
|
+
this.children.push(child);
|
|
1473
|
+
}
|
|
1474
|
+
asRelative(p) {
|
|
1475
|
+
if (p.substring(0, 1) === "/") {
|
|
1476
|
+
return p.substring(1);
|
|
1477
|
+
}
|
|
1478
|
+
return p;
|
|
1479
|
+
}
|
|
1480
|
+
getQualifiedName() {
|
|
1481
|
+
return this.asRelative(this.path.toString());
|
|
1482
|
+
}
|
|
1483
|
+
getRelativeName() {
|
|
1484
|
+
const parent = this.getParent();
|
|
1485
|
+
const myPath = this.path;
|
|
1486
|
+
let relPath;
|
|
1487
|
+
let i;
|
|
1488
|
+
const parentPath = parent ? parent.path : new Path([]);
|
|
1489
|
+
if (parentPath.ancestorOf(myPath)) {
|
|
1490
|
+
relPath = new Path(myPath.elements());
|
|
1491
|
+
for (i = 0; i < parentPath.length; i += 1) {
|
|
1492
|
+
relPath.shift();
|
|
1493
|
+
}
|
|
1494
|
+
return this.asRelative(relPath.toString());
|
|
1495
|
+
}
|
|
1496
|
+
return this.asRelative(this.path.toString());
|
|
1497
|
+
}
|
|
1498
|
+
getParent() {
|
|
1499
|
+
return this.parent;
|
|
1500
|
+
}
|
|
1501
|
+
getChildren() {
|
|
1502
|
+
return this.children;
|
|
1503
|
+
}
|
|
1504
|
+
isSummary() {
|
|
1505
|
+
return !this.fileCoverage;
|
|
1506
|
+
}
|
|
1507
|
+
getFileCoverage() {
|
|
1508
|
+
return this.fileCoverage;
|
|
1509
|
+
}
|
|
1510
|
+
getCoverageSummary(filesOnly) {
|
|
1511
|
+
const cacheProp = `c_${filesOnly ? "files" : "full"}`;
|
|
1512
|
+
let summary;
|
|
1513
|
+
if (Object.prototype.hasOwnProperty.call(this, cacheProp)) {
|
|
1514
|
+
return this[cacheProp];
|
|
1515
|
+
}
|
|
1516
|
+
if (!this.isSummary()) {
|
|
1517
|
+
summary = this.getFileCoverage().toSummary();
|
|
1518
|
+
} else {
|
|
1519
|
+
let count = 0;
|
|
1520
|
+
summary = coverage.createCoverageSummary();
|
|
1521
|
+
this.getChildren().forEach((child) => {
|
|
1522
|
+
if (filesOnly && child.isSummary()) {
|
|
1523
|
+
return;
|
|
1524
|
+
}
|
|
1525
|
+
count += 1;
|
|
1526
|
+
summary.merge(child.getCoverageSummary(filesOnly));
|
|
1527
|
+
});
|
|
1528
|
+
if (count === 0 && filesOnly) {
|
|
1529
|
+
summary = null;
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
this[cacheProp] = summary;
|
|
1533
|
+
return summary;
|
|
1534
|
+
}
|
|
1535
|
+
};
|
|
1536
|
+
var ReportTree = class extends BaseTree {
|
|
1537
|
+
static {
|
|
1538
|
+
__name(this, "ReportTree");
|
|
1539
|
+
}
|
|
1540
|
+
constructor(root, childPrefix) {
|
|
1541
|
+
super(root);
|
|
1542
|
+
const maybePrefix = /* @__PURE__ */ __name((node) => {
|
|
1543
|
+
if (childPrefix && !node.isRoot()) {
|
|
1544
|
+
node.path.unshift(childPrefix);
|
|
1545
|
+
}
|
|
1546
|
+
}, "maybePrefix");
|
|
1547
|
+
this.visit({
|
|
1548
|
+
onDetail: maybePrefix,
|
|
1549
|
+
onSummary(node) {
|
|
1550
|
+
maybePrefix(node);
|
|
1551
|
+
node.children.sort((a, b) => {
|
|
1552
|
+
const astr = a.path.toString();
|
|
1553
|
+
const bstr = b.path.toString();
|
|
1554
|
+
return astr < bstr ? -1 : astr > bstr ? 1 : (
|
|
1555
|
+
/* istanbul ignore next */
|
|
1556
|
+
0
|
|
1557
|
+
);
|
|
1558
|
+
});
|
|
1559
|
+
}
|
|
1560
|
+
});
|
|
1561
|
+
}
|
|
1562
|
+
};
|
|
1563
|
+
function findCommonParent(paths) {
|
|
1564
|
+
return paths.reduce(
|
|
1565
|
+
(common, path) => common.commonPrefixPath(path),
|
|
1566
|
+
paths[0] || new Path([])
|
|
1567
|
+
);
|
|
1568
|
+
}
|
|
1569
|
+
__name(findCommonParent, "findCommonParent");
|
|
1570
|
+
function findOrCreateParent(parentPath, nodeMap, created = () => {
|
|
1571
|
+
}) {
|
|
1572
|
+
let parent = nodeMap[parentPath.toString()];
|
|
1573
|
+
if (!parent) {
|
|
1574
|
+
parent = new ReportNode(parentPath);
|
|
1575
|
+
nodeMap[parentPath.toString()] = parent;
|
|
1576
|
+
created(parentPath, parent);
|
|
1577
|
+
}
|
|
1578
|
+
return parent;
|
|
1579
|
+
}
|
|
1580
|
+
__name(findOrCreateParent, "findOrCreateParent");
|
|
1581
|
+
function toDirParents(list) {
|
|
1582
|
+
const nodeMap = /* @__PURE__ */ Object.create(null);
|
|
1583
|
+
list.forEach((o) => {
|
|
1584
|
+
const parent = findOrCreateParent(o.path.parent(), nodeMap);
|
|
1585
|
+
parent.addChild(new ReportNode(o.path, o.fileCoverage));
|
|
1586
|
+
});
|
|
1587
|
+
return Object.values(nodeMap);
|
|
1588
|
+
}
|
|
1589
|
+
__name(toDirParents, "toDirParents");
|
|
1590
|
+
function addAllPaths(topPaths, nodeMap, path, node) {
|
|
1591
|
+
const parent = findOrCreateParent(
|
|
1592
|
+
path.parent(),
|
|
1593
|
+
nodeMap,
|
|
1594
|
+
(parentPath, parent2) => {
|
|
1595
|
+
if (parentPath.hasParent()) {
|
|
1596
|
+
addAllPaths(topPaths, nodeMap, parentPath, parent2);
|
|
1597
|
+
} else {
|
|
1598
|
+
topPaths.push(parent2);
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
);
|
|
1602
|
+
parent.addChild(node);
|
|
1603
|
+
}
|
|
1604
|
+
__name(addAllPaths, "addAllPaths");
|
|
1605
|
+
function foldIntoOneDir(node, parent) {
|
|
1606
|
+
const { children } = node;
|
|
1607
|
+
if (children.length === 1 && !children[0].fileCoverage) {
|
|
1608
|
+
children[0].parent = parent;
|
|
1609
|
+
return foldIntoOneDir(children[0], parent);
|
|
1610
|
+
}
|
|
1611
|
+
node.children = children.map((child) => foldIntoOneDir(child, node));
|
|
1612
|
+
return node;
|
|
1613
|
+
}
|
|
1614
|
+
__name(foldIntoOneDir, "foldIntoOneDir");
|
|
1615
|
+
function pkgSummaryPrefix(dirParents, commonParent) {
|
|
1616
|
+
if (!dirParents.some((dp) => dp.path.length === 0)) {
|
|
1617
|
+
return;
|
|
1618
|
+
}
|
|
1619
|
+
if (commonParent.length === 0) {
|
|
1620
|
+
return "root";
|
|
1621
|
+
}
|
|
1622
|
+
return commonParent.name();
|
|
1623
|
+
}
|
|
1624
|
+
__name(pkgSummaryPrefix, "pkgSummaryPrefix");
|
|
1625
|
+
var SummarizerFactory = class {
|
|
1626
|
+
static {
|
|
1627
|
+
__name(this, "SummarizerFactory");
|
|
1628
|
+
}
|
|
1629
|
+
constructor(coverageMap, defaultSummarizer = "pkg") {
|
|
1630
|
+
this._coverageMap = coverageMap;
|
|
1631
|
+
this._defaultSummarizer = defaultSummarizer;
|
|
1632
|
+
this._initialList = coverageMap.files().map((filePath) => ({
|
|
1633
|
+
filePath,
|
|
1634
|
+
path: new Path(filePath),
|
|
1635
|
+
fileCoverage: coverageMap.fileCoverageFor(filePath)
|
|
1636
|
+
}));
|
|
1637
|
+
this._commonParent = findCommonParent(
|
|
1638
|
+
this._initialList.map((o) => o.path.parent())
|
|
1639
|
+
);
|
|
1640
|
+
if (this._commonParent.length > 0) {
|
|
1641
|
+
this._initialList.forEach((o) => {
|
|
1642
|
+
o.path.splice(0, this._commonParent.length);
|
|
1643
|
+
});
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
get defaultSummarizer() {
|
|
1647
|
+
return this[this._defaultSummarizer];
|
|
1648
|
+
}
|
|
1649
|
+
get flat() {
|
|
1650
|
+
if (!this._flat) {
|
|
1651
|
+
this._flat = new ReportTree(
|
|
1652
|
+
ReportNode.createRoot(
|
|
1653
|
+
this._initialList.map(
|
|
1654
|
+
(node) => new ReportNode(node.path, node.fileCoverage)
|
|
1655
|
+
)
|
|
1656
|
+
)
|
|
1657
|
+
);
|
|
1658
|
+
}
|
|
1659
|
+
return this._flat;
|
|
1660
|
+
}
|
|
1661
|
+
_createPkg() {
|
|
1662
|
+
const dirParents = toDirParents(this._initialList);
|
|
1663
|
+
if (dirParents.length === 1) {
|
|
1664
|
+
return new ReportTree(dirParents[0]);
|
|
1665
|
+
}
|
|
1666
|
+
return new ReportTree(
|
|
1667
|
+
ReportNode.createRoot(dirParents),
|
|
1668
|
+
pkgSummaryPrefix(dirParents, this._commonParent)
|
|
1669
|
+
);
|
|
1670
|
+
}
|
|
1671
|
+
get pkg() {
|
|
1672
|
+
if (!this._pkg) {
|
|
1673
|
+
this._pkg = this._createPkg();
|
|
1674
|
+
}
|
|
1675
|
+
return this._pkg;
|
|
1676
|
+
}
|
|
1677
|
+
_createNested() {
|
|
1678
|
+
const nodeMap = /* @__PURE__ */ Object.create(null);
|
|
1679
|
+
const topPaths = [];
|
|
1680
|
+
this._initialList.forEach((o) => {
|
|
1681
|
+
const node = new ReportNode(o.path, o.fileCoverage);
|
|
1682
|
+
addAllPaths(topPaths, nodeMap, o.path, node);
|
|
1683
|
+
});
|
|
1684
|
+
const topNodes = topPaths.map((node) => foldIntoOneDir(node));
|
|
1685
|
+
if (topNodes.length === 1) {
|
|
1686
|
+
return new ReportTree(topNodes[0]);
|
|
1687
|
+
}
|
|
1688
|
+
return new ReportTree(ReportNode.createRoot(topNodes));
|
|
1689
|
+
}
|
|
1690
|
+
get nested() {
|
|
1691
|
+
if (!this._nested) {
|
|
1692
|
+
this._nested = this._createNested();
|
|
1693
|
+
}
|
|
1694
|
+
return this._nested;
|
|
1695
|
+
}
|
|
1696
|
+
};
|
|
1697
|
+
module.exports = SummarizerFactory;
|
|
1698
|
+
}
|
|
1699
|
+
});
|
|
1700
|
+
|
|
1701
|
+
// ../../node_modules/istanbul-lib-report/lib/context.js
|
|
1702
|
+
var require_context = __commonJS({
|
|
1703
|
+
"../../node_modules/istanbul-lib-report/lib/context.js"(exports, module) {
|
|
1704
|
+
"use strict";
|
|
1705
|
+
var fs = __require("fs");
|
|
1706
|
+
var FileWriter = require_file_writer();
|
|
1707
|
+
var XMLWriter = require_xml_writer();
|
|
1708
|
+
var tree = require_tree();
|
|
1709
|
+
var watermarks = require_watermarks();
|
|
1710
|
+
var SummarizerFactory = require_summarizer_factory();
|
|
1711
|
+
function defaultSourceLookup(path) {
|
|
1712
|
+
try {
|
|
1713
|
+
return fs.readFileSync(path, "utf8");
|
|
1714
|
+
} catch (ex) {
|
|
1715
|
+
throw new Error(`Unable to lookup source: ${path} (${ex.message})`);
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
__name(defaultSourceLookup, "defaultSourceLookup");
|
|
1719
|
+
function normalizeWatermarks(specified = {}) {
|
|
1720
|
+
Object.entries(watermarks.getDefault()).forEach(([k, value]) => {
|
|
1721
|
+
const specValue = specified[k];
|
|
1722
|
+
if (!Array.isArray(specValue) || specValue.length !== 2) {
|
|
1723
|
+
specified[k] = value;
|
|
1724
|
+
}
|
|
1725
|
+
});
|
|
1726
|
+
return specified;
|
|
1727
|
+
}
|
|
1728
|
+
__name(normalizeWatermarks, "normalizeWatermarks");
|
|
1729
|
+
var Context = class {
|
|
1730
|
+
static {
|
|
1731
|
+
__name(this, "Context");
|
|
1732
|
+
}
|
|
1733
|
+
constructor(opts) {
|
|
1734
|
+
this.dir = opts.dir || "coverage";
|
|
1735
|
+
this.watermarks = normalizeWatermarks(opts.watermarks);
|
|
1736
|
+
this.sourceFinder = opts.sourceFinder || defaultSourceLookup;
|
|
1737
|
+
this._summarizerFactory = new SummarizerFactory(
|
|
1738
|
+
opts.coverageMap,
|
|
1739
|
+
opts.defaultSummarizer
|
|
1740
|
+
);
|
|
1741
|
+
this.data = {};
|
|
1742
|
+
}
|
|
1743
|
+
/**
|
|
1744
|
+
* returns a FileWriter implementation for reporting use. Also available
|
|
1745
|
+
* as the `writer` property on the context.
|
|
1746
|
+
* @returns {Writer}
|
|
1747
|
+
*/
|
|
1748
|
+
getWriter() {
|
|
1749
|
+
return this.writer;
|
|
1750
|
+
}
|
|
1751
|
+
/**
|
|
1752
|
+
* returns the source code for the specified file path or throws if
|
|
1753
|
+
* the source could not be found.
|
|
1754
|
+
* @param {String} filePath the file path as found in a file coverage object
|
|
1755
|
+
* @returns {String} the source code
|
|
1756
|
+
*/
|
|
1757
|
+
getSource(filePath) {
|
|
1758
|
+
return this.sourceFinder(filePath);
|
|
1759
|
+
}
|
|
1760
|
+
/**
|
|
1761
|
+
* returns the coverage class given a coverage
|
|
1762
|
+
* types and a percentage value.
|
|
1763
|
+
* @param {String} type - the coverage type, one of `statements`, `functions`,
|
|
1764
|
+
* `branches`, or `lines`
|
|
1765
|
+
* @param {Number} value - the percentage value
|
|
1766
|
+
* @returns {String} one of `high`, `medium` or `low`
|
|
1767
|
+
*/
|
|
1768
|
+
classForPercent(type, value) {
|
|
1769
|
+
const watermarks2 = this.watermarks[type];
|
|
1770
|
+
if (!watermarks2) {
|
|
1771
|
+
return "unknown";
|
|
1772
|
+
}
|
|
1773
|
+
if (value < watermarks2[0]) {
|
|
1774
|
+
return "low";
|
|
1775
|
+
}
|
|
1776
|
+
if (value >= watermarks2[1]) {
|
|
1777
|
+
return "high";
|
|
1778
|
+
}
|
|
1779
|
+
return "medium";
|
|
1780
|
+
}
|
|
1781
|
+
/**
|
|
1782
|
+
* returns an XML writer for the supplied content writer
|
|
1783
|
+
* @param {ContentWriter} contentWriter the content writer to which the returned XML writer
|
|
1784
|
+
* writes data
|
|
1785
|
+
* @returns {XMLWriter}
|
|
1786
|
+
*/
|
|
1787
|
+
getXMLWriter(contentWriter) {
|
|
1788
|
+
return new XMLWriter(contentWriter);
|
|
1789
|
+
}
|
|
1790
|
+
/**
|
|
1791
|
+
* returns a full visitor given a partial one.
|
|
1792
|
+
* @param {Object} partialVisitor a partial visitor only having the functions of
|
|
1793
|
+
* interest to the caller. These functions are called with a scope that is the
|
|
1794
|
+
* supplied object.
|
|
1795
|
+
* @returns {Visitor}
|
|
1796
|
+
*/
|
|
1797
|
+
getVisitor(partialVisitor) {
|
|
1798
|
+
return new tree.Visitor(partialVisitor);
|
|
1799
|
+
}
|
|
1800
|
+
getTree(name = "defaultSummarizer") {
|
|
1801
|
+
return this._summarizerFactory[name];
|
|
1802
|
+
}
|
|
1803
|
+
};
|
|
1804
|
+
Object.defineProperty(Context.prototype, "writer", {
|
|
1805
|
+
enumerable: true,
|
|
1806
|
+
get() {
|
|
1807
|
+
if (!this.data.writer) {
|
|
1808
|
+
this.data.writer = new FileWriter(this.dir);
|
|
1809
|
+
}
|
|
1810
|
+
return this.data.writer;
|
|
1811
|
+
}
|
|
1812
|
+
});
|
|
1813
|
+
module.exports = Context;
|
|
1814
|
+
}
|
|
1815
|
+
});
|
|
1816
|
+
|
|
1817
|
+
// ../../node_modules/istanbul-lib-report/lib/report-base.js
|
|
1818
|
+
var require_report_base = __commonJS({
|
|
1819
|
+
"../../node_modules/istanbul-lib-report/lib/report-base.js"(exports, module) {
|
|
1820
|
+
"use strict";
|
|
1821
|
+
var _summarizer = Symbol("ReportBase.#summarizer");
|
|
1822
|
+
var ReportBase2 = class {
|
|
1823
|
+
static {
|
|
1824
|
+
__name(this, "ReportBase");
|
|
1825
|
+
}
|
|
1826
|
+
constructor(opts = {}) {
|
|
1827
|
+
this[_summarizer] = opts.summarizer;
|
|
1828
|
+
}
|
|
1829
|
+
execute(context) {
|
|
1830
|
+
context.getTree(this[_summarizer]).visit(this, context);
|
|
1831
|
+
}
|
|
1832
|
+
};
|
|
1833
|
+
module.exports = ReportBase2;
|
|
1834
|
+
}
|
|
1835
|
+
});
|
|
1836
|
+
|
|
1837
|
+
// ../../node_modules/istanbul-lib-report/index.js
|
|
1838
|
+
var require_istanbul_lib_report = __commonJS({
|
|
1839
|
+
"../../node_modules/istanbul-lib-report/index.js"(exports, module) {
|
|
1840
|
+
"use strict";
|
|
1841
|
+
var Context = require_context();
|
|
1842
|
+
var watermarks = require_watermarks();
|
|
1843
|
+
var ReportBase2 = require_report_base();
|
|
1844
|
+
module.exports = {
|
|
1845
|
+
/**
|
|
1846
|
+
* returns a reporting context for the supplied options
|
|
1847
|
+
* @param {Object} [opts=null] opts
|
|
1848
|
+
* @returns {Context}
|
|
1849
|
+
*/
|
|
1850
|
+
createContext(opts) {
|
|
1851
|
+
return new Context(opts);
|
|
1852
|
+
},
|
|
1853
|
+
/**
|
|
1854
|
+
* returns the default watermarks that would be used when not
|
|
1855
|
+
* overridden
|
|
1856
|
+
* @returns {Object} an object with `statements`, `functions`, `branches`,
|
|
1857
|
+
* and `line` keys. Each value is a 2 element array that has the low and
|
|
1858
|
+
* high watermark as percentages.
|
|
1859
|
+
*/
|
|
1860
|
+
getDefaultWatermarks() {
|
|
1861
|
+
return watermarks.getDefault();
|
|
1862
|
+
},
|
|
1863
|
+
/**
|
|
1864
|
+
* Base class for all reports
|
|
1865
|
+
*/
|
|
1866
|
+
ReportBase: ReportBase2
|
|
1867
|
+
};
|
|
1868
|
+
}
|
|
1869
|
+
});
|
|
1870
|
+
|
|
1871
|
+
// src/node/coverage-reporter.ts
|
|
1872
|
+
var import_istanbul_lib_report = __toESM(require_istanbul_lib_report(), 1);
|
|
1873
|
+
var StorybookCoverageReporter = class extends import_istanbul_lib_report.ReportBase {
|
|
1874
|
+
static {
|
|
1875
|
+
__name(this, "StorybookCoverageReporter");
|
|
1876
|
+
}
|
|
1877
|
+
#testManager;
|
|
1878
|
+
#coverageOptions;
|
|
1879
|
+
constructor(opts) {
|
|
1880
|
+
super();
|
|
1881
|
+
this.#testManager = opts.testManager;
|
|
1882
|
+
this.#coverageOptions = opts.coverageOptions;
|
|
1883
|
+
}
|
|
1884
|
+
onSummary(node) {
|
|
1885
|
+
if (!node.isRoot()) {
|
|
1886
|
+
return;
|
|
1887
|
+
}
|
|
1888
|
+
const rawCoverageSummary = node.getCoverageSummary(false);
|
|
1889
|
+
const percentage = Math.round(rawCoverageSummary.data.statements.pct);
|
|
1890
|
+
const [lowWatermark = 50, highWatermark = 80] = this.#coverageOptions?.watermarks?.statements ?? [];
|
|
1891
|
+
const coverageSummary = {
|
|
1892
|
+
percentage,
|
|
1893
|
+
status: percentage < lowWatermark ? "negative" : percentage < highWatermark ? "warning" : "positive"
|
|
1894
|
+
};
|
|
1895
|
+
this.#testManager.onCoverageCollected(coverageSummary);
|
|
1896
|
+
}
|
|
1897
|
+
};
|
|
1898
|
+
export {
|
|
1899
|
+
StorybookCoverageReporter as "module.exports"
|
|
1900
|
+
};
|