UNPKG

@ycmd/commands

Version:

LSK.js CLI Creds is the easiest way to manage GitHub / Gitlab secrets and credentials

9 lines (7 loc) 2.51 kB
import { existsSync } from 'node:fs'; import { join } from 'node:path'; import { isCI, isDev, createCommand, shellParallel, readJson, findBin, getCwdInfo, shell } from 'ycmd'; var T=Object.defineProperty;var u=(s,t)=>T(s,"name",{value:t,configurable:!0});var l={watch:{alias:"w",describe:"monitor files for changes",type:"boolean",default:!1},prod:{alias:"p",describe:"enable code optimization for production",type:"boolean",default:!1},silent:{alias:["s","q","quiet"],describe:"run in silent mode, show errors only",type:"boolean",default:!1},exec:{alias:"e",describe:"executes after compilation",type:["boolean","string"],default:!1},dry:{alias:["d","dry-run","without-publish"],describe:"run in dry mode, without publishing",type:"boolean",default:!1},dist:{describe:"specify the output directory",type:"string"},force:{alias:["f"],describe:"force to run",type:"boolean",default:!1},dts:{describe:"generate dts files",type:"boolean",default:!0},yes:{alias:["y"],describe:"automatically say yes to all prompts",type:"boolean",default:!1},bail:{alias:"b",describe:"stop running after the first failure",type:"boolean",default:!1},clean:{alias:"c",describe:"clean the output directory before building",type:"boolean",default:!1}};var y={isSilent:!!+process.env.YCMD_SILENT||isCI,isBail:isCI,isProd:!!+process.env.YCMD_PROD||!isDev,isCjs:!0,libDir:"lib",cjsDir:"cjs"};var x=u((s,t)=>{let i={...s};return t.forEach(a=>delete i[a]),i},"omit"),R=createCommand({command:"test:jest [-w][-p][-s]",describe:"run jest tests",builder:s=>s.options({watch:l.watch,silent:l.silent}),async main({isRoot:s,cwd:t,ctx:i,args:a,log:f,argv:j}){if(s){await shellParallel("ycmd test:jest",{ctx:i,args:a});return}let w=join(t,"package.json");if(!(await readJson(w))?.jest){f.debug("[skip] jest rc not found in package.json");return}let{silent:o=y.isSilent,watch:n=!1}=j,e=findBin("jest");e+=" --detectOpenHandles --coverage",n||(e+=" --forceExit --runInBand");let{rootPath:C}=await getCwdInfo({cwd:t}),r=`${C}/scripts/jest.config.js`;o&&(e+=" --silent"),o&&(e+=" --ci"),n&&(e+=" --watch"),r&&existsSync(r)&&(e+=` --config ${r}`),e+=` --rootDir ${t}`;let d=`${t}/tsconfig.test.json`;existsSync(d)&&(e=`JEST_TSCONFIG=${d} ${e}`);let O=o?["inherit","ignore","ignore"]:"inherit";if(n)await shell(e,{ctx:i});else try{await shell(e,{ctx:i,stdio:O});}catch(p){if(!o)throw p;f.fatal("test:jest",x(p,["proc"])),await shell(e,{ctx:i});}}}); export { R as default }; //# sourceMappingURL=out.js.map //# sourceMappingURL=test-jest.js.map