UNPKG

@bomb.sh/tools

Version:

The internal dev, build, and lint CLI for Bombshell projects

1 lines 1.24 kB
{"version":3,"file":"test.mjs","names":[],"sources":["../../src/commands/test.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\nimport { x } from \"tinyexec\";\nimport type { CommandContext } from \"../context.ts\";\nimport { local } from \"../utils.ts\";\n\nfunction resolveConfig(): string {\n\t// Built output (.mjs) or source (.ts)\n\tfor (const ext of [\".mjs\", \".ts\"]) {\n\t\tconst url = new URL(`../test-utils/vitest.config${ext}`, import.meta.url);\n\t\tconst path = fileURLToPath(url);\n\t\tif (existsSync(path)) return path;\n\t}\n\tthrow new Error(\"Could not resolve vitest.config file\");\n}\n\nexport async function test(ctx: CommandContext) {\n\tconst stdio = x(local(\"vitest\"), [\"run\", \"--config\", resolveConfig(), ...ctx.args]);\n\n\tfor await (const line of stdio) {\n\t\tconsole.log(line);\n\t}\n}\n"],"mappings":";;;;;;AAMA,SAAS,gBAAwB;AAEhC,MAAK,MAAM,OAAO,CAAC,QAAQ,MAAM,EAAE;EAElC,MAAM,OAAO,cADD,IAAI,IAAI,8BAA8B,OAAO,OAAO,KAAK,IAAI,CAC1C;AAC/B,MAAI,WAAW,KAAK,CAAE,QAAO;;AAE9B,OAAM,IAAI,MAAM,uCAAuC;;AAGxD,eAAsB,KAAK,KAAqB;CAC/C,MAAM,QAAQ,EAAE,MAAM,SAAS,EAAE;EAAC;EAAO;EAAY,eAAe;EAAE,GAAG,IAAI;EAAK,CAAC;AAEnF,YAAW,MAAM,QAAQ,MACxB,SAAQ,IAAI,KAAK"}