[READ-ONLY] Mirror of https://github.com/bombshell-dev/tools. Internal CLI to standardize tooling across all Bombshell projects
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930import { fileURLToPath } from 'node:url';import { x } from 'tinyexec';import { describe, it, expect } from 'vitest';import { createFixture } from '../test-utils/index.ts';
const bin = fileURLToPath(new URL('../bin.ts', import.meta.url));
async function runBshTest(assertion: string): Promise<number | undefined> { const fixture = await createFixture({ 'package.json': { name: 'test-pkg', type: 'module' }, 'index.test.ts': `import { it, expect } from 'vitest';\nit('case', () => { ${assertion} });\n`, }); const result = await x( process.execPath, ['--experimental-strip-types', '--no-warnings', bin, 'test'], { nodeOptions: { cwd: fileURLToPath(fixture.root) }, throwOnError: false }, ); return result.exitCode;}
describe('test command', () => { it('exits non-zero when a test fails', async () => { expect(await runBshTest('expect(1).toBe(2);')).toBe(1); });
it('exits zero when all tests pass', async () => { expect(await runBshTest('expect(1).toBe(1);')).toBe(0); });});