Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

2.6 KB
Raw Blame
const fs = require('node:fs');
const os = require('node:os');
const path = require('node:path');
const { execFileSync } = require('node:child_process');
const { loadNycConfig } = require('@istanbuljs/load-nyc-config');

// The security override crosses load-nyc-config's declared js-yaml major.
// Exercise its real YAML loader and CLI rather than just checking the lockfile.
describe('coverage YAML toolchain compatibility', () => {
    let directory;

    beforeEach(() => {
        directory = fs.mkdtempSync(path.join(os.tmpdir(), 'ldr-nyc-yaml-'));
        fs.writeFileSync(path.join(directory, 'package.json'), '{}');
    });

    afterEach(() => {
        fs.rmSync(directory, { recursive: true, force: true });
    });

    test('loads inherited YAML coverage settings with their types intact', async () => {
        fs.writeFileSync(path.join(directory, 'base.yml'), [
            'all: true',
            'exclude:',
            '  - "fixtures/**"',
            'watermarks:',
            '  lines: [80, 95]',
        ].join('\n'));
        fs.writeFileSync(path.join(directory, '.nycrc.yml'), [
            'extends: ./base.yml',
            'include:',
            '  - "src/**/*.js"',
            'extension: .js',
            'check-coverage: true',
            'lines: 87.5',
        ].join('\n'));

        const config = await loadNycConfig({ cwd: directory });

        expect(config).toMatchObject({
            cwd: directory,
            all: true,
            exclude: ['fixtures/**'],
            include: ['src/**/*.js'],
            extension: ['.js'],
            checkCoverage: true,
            lines: 87.5,
            watermarks: { lines: [80, 95] },
        });
    });

    test('keeps the YAML CLI version and conversion commands working', () => {
        const manifestPath = require.resolve('js-yaml/package.json');
        const manifest = require(manifestPath);
        const cli = path.join(path.dirname(manifestPath), manifest.bin['js-yaml']);
        const version = execFileSync(process.execPath, [cli, '--version'], {
            encoding: 'utf8',
            timeout: 5000,
        });
        expect(version.trim()).toBe(manifest.version);

        const yamlPath = path.join(directory, 'config.yml');
        fs.writeFileSync(yamlPath, 'enabled: true\ninclude: [src]\nlines: 87.5\n');
        const converted = execFileSync(process.execPath, [cli, yamlPath], {
            encoding: 'utf8',
            timeout: 5000,
        });
        expect(JSON.parse(converted)).toEqual({
            enabled: true,
            include: ['src'],
            lines: 87.5,
        });
    });
});