Files
verdaccio/packages/config/test/parse.spec.ts
Marc Bernard b24f513b92 chore(lint): switch rules from jest to vitest (#5470)
* chore(lint): switch rules from jest to vitest

* Revert tsconfig

* Update active-directory
2025-11-10 23:00:04 +01:00

28 lines
914 B
TypeScript

import path from 'node:path';
import { describe, expect, test } from 'vitest';
import { getConfigParsed, parseConfigFile } from '../src';
describe('getConfigParsed', () => {
const partialsDir = path.join(__dirname, './partials/config/yaml');
test('parses config from a YAML file path', () => {
const yamlFile = path.join(partialsDir, 'config-getMatchedPackagesSpec.yaml');
const config = getConfigParsed(yamlFile);
expect(config).toBeDefined();
});
test('parses config from JSON', () => {
const yamlFile = path.join(partialsDir, 'config-getMatchedPackagesSpec.yaml');
const config = getConfigParsed(parseConfigFile(yamlFile));
expect(config).toBeDefined();
});
test('throws error for invalid config type', () => {
// @ts-expect-error
expect(() => getConfigParsed(123)).toThrow();
// @ts-expect-error
expect(() => getConfigParsed(true)).toThrow();
});
});