fix(cli): read version from file

This commit is contained in:
Peter Steinberger
2025-12-26 12:05:52 +01:00
parent 674fee3b8a
commit 9222908ab7
3 changed files with 59 additions and 1 deletions
+12
View File
@@ -0,0 +1,12 @@
import { readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { describe, expect, it } from 'vitest';
import { getCliVersion } from '../src/lib/version.js';
describe('getCliVersion', () => {
it('matches package.json version when available', () => {
const raw = readFileSync(fileURLToPath(new URL('../package.json', import.meta.url)), 'utf8');
const pkg = JSON.parse(raw) as { version?: unknown };
expect(getCliVersion()).toBe(pkg.version);
});
});