mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-11-23 09:17:50 +08:00
29 lines
1.0 KiB
TypeScript
29 lines
1.0 KiB
TypeScript
import { describe, expect, test } from 'bun:test';
|
|
import { readFileSync } from 'node:fs';
|
|
|
|
const readProjectFile = (path: string) =>
|
|
readFileSync(new URL(`../${path}`, import.meta.url), 'utf8');
|
|
const packageJson = JSON.parse(readProjectFile('package.json')) as { packageManager: string };
|
|
const bunVersion = packageJson.packageManager.match(/^bun@(\d+\.\d+\.\d+)$/)?.[1];
|
|
|
|
describe('Bun toolchain version', () => {
|
|
test('pins an exact Bun release', () => {
|
|
expect(bunVersion).toBeDefined();
|
|
});
|
|
|
|
test.each(['.github/workflows/ci.yml', '.github/workflows/release.yml'])(
|
|
'%s uses the pinned Bun release',
|
|
(path) => {
|
|
expect(readProjectFile(path)).toContain(`bun-version: '${bunVersion}'`);
|
|
}
|
|
);
|
|
|
|
test.each(['README.md', 'README_CN.md'])('%s documents the pinned Bun release', (path) => {
|
|
expect(readProjectFile(path)).toContain(`**Bun ${bunVersion}**`);
|
|
});
|
|
|
|
test('repository guidance documents the pinned Bun release', () => {
|
|
expect(readProjectFile('AGENTS.md')).toContain(`\`bun@${bunVersion}\``);
|
|
});
|
|
});
|