27 lines
941 B
JavaScript
27 lines
941 B
JavaScript
import assert from 'assert';
|
|
import { fileURLToPath } from 'url';
|
|
import path from 'path';
|
|
import { execFileSync } from 'child_process';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
const root = path.join(__dirname, '..');
|
|
|
|
const fixturesDir = path.join(root, 'scripts', '__fixtures__', 'api-compat');
|
|
const oldSpec = path.join(fixturesDir, 'old.yaml');
|
|
const newSpec = path.join(fixturesDir, 'new.yaml');
|
|
|
|
const output = execFileSync('node', ['scripts/api-compat-changelog.mjs', oldSpec, newSpec, '--title', 'Test Report'], {
|
|
cwd: root,
|
|
encoding: 'utf8',
|
|
});
|
|
|
|
assert(output.includes('# Test Report'));
|
|
assert(output.includes('Additive operations: 1'));
|
|
assert(output.includes('Breaking operations: 0'));
|
|
assert(output.includes('- get /bar'));
|
|
assert(output.includes('- get /foo -> 201'));
|
|
assert(output.includes('- get /foo -> 200'));
|
|
|
|
console.log('api-compat-changelog test passed');
|