Skip to content

Visual Studio Code, rebuilt in Rust

Rust
1.1 KB
Raw Blame
import { expect, test } from 'bun:test';
import { join } from 'node:path';

function rust(paths: string[]) {
	const run = Bun.spawnSync(['bash', join(import.meta.dir, 'ci-changes')], { stdin: Buffer.from(paths.map(path => `${path}\n`).join('')) });
	expect(run.exitCode).toBe(0);
	return run.stdout.toString();
}

test('documents, agent files and README pictures skip the Rust jobs', () => {
	expect(rust(['README.md', 'AGENTS.md', 'docs/performance.md', 'port/notes.md', 'port/ledger.md', '.agents/skills/pr/SKILL.md', 'port/assets/icon.png', 'port/plans/a.md'])).toBe('rust=false\n');
});

test('one path outside the list runs them, whatever it is', () => {
	for (const path of ['native/crates/app/src/main.rs', 'native/crates/app/src/workbench/walkthrough_part/vs_code_editor_walkthrough.md', 'port/patches/a.md', 'port/product.json', 'port/AppIcon.icon/icon.json', '.github/workflows/ci.yml', 'port/tools/ci-changes', 'flake.nix', 'new-folder/file']) {
		expect(rust(['README.md', path])).toBe('rust=true\n');
	}
});

test('no path at all runs them', () => {
	expect(rust([])).toBe('rust=true\n');
});