mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-14 05:43:29 +08:00
fix: harden release surface version and packaging sync (#1388)
* fix: keep ecc release surfaces version-synced * fix: keep lockfile release version in sync * fix: remove release version drift from locks and tests * fix: keep root release metadata version-synced * fix: keep codex marketplace metadata version-synced * fix: gate release workflows on full metadata sync * fix: ship all versioned release metadata * fix: harden manual release path * fix: keep localized release docs version-synced * fix: sync install architecture version examples * test: cover shipped plugin metadata in npm pack * fix: verify final npm payload in release script * fix: ship opencode lockfile in npm package * docs: sync localized release highlights * fix: stabilize windows ci portability * fix: tighten release script version sync * fix: prefer repo-relative hook file paths * fix: make npm pack test shell-safe on windows
This commit is contained in:
71
tests/scripts/release.test.js
Normal file
71
tests/scripts/release.test.js
Normal file
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* Source-level tests for scripts/release.sh
|
||||
*/
|
||||
|
||||
const assert = require('assert');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const scriptPath = path.join(__dirname, '..', '..', 'scripts', 'release.sh');
|
||||
const source = fs.readFileSync(scriptPath, 'utf8');
|
||||
|
||||
function test(name, fn) {
|
||||
try {
|
||||
fn();
|
||||
console.log(` ✓ ${name}`);
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.log(` ✗ ${name}`);
|
||||
console.log(` Error: ${error.message}`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function runTests() {
|
||||
console.log('\n=== Testing release.sh ===\n');
|
||||
|
||||
let passed = 0;
|
||||
let failed = 0;
|
||||
|
||||
if (test('release script rejects untracked files when checking cleanliness', () => {
|
||||
assert.ok(
|
||||
source.includes('git status --porcelain --untracked-files=all'),
|
||||
'release.sh should use git status --porcelain --untracked-files=all for cleanliness checks'
|
||||
);
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('release script reruns release metadata sync validation before commit/tag', () => {
|
||||
const syncCheckIndex = source.lastIndexOf('node tests/plugin-manifest.test.js');
|
||||
const commitIndex = source.indexOf('git commit -m "chore: bump plugin version to $VERSION"');
|
||||
|
||||
assert.ok(syncCheckIndex >= 0, 'release.sh should run plugin-manifest.test.js');
|
||||
assert.ok(commitIndex >= 0, 'release.sh should create the release commit');
|
||||
assert.ok(
|
||||
syncCheckIndex < commitIndex,
|
||||
'plugin-manifest.test.js should run before the release commit is created'
|
||||
);
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('release script verifies npm pack payload after version updates and before commit/tag', () => {
|
||||
const updateIndex = source.indexOf('update_version "$ROOT_PACKAGE_JSON"');
|
||||
const packCheckIndex = source.indexOf('node tests/scripts/build-opencode.test.js');
|
||||
const commitIndex = source.indexOf('git commit -m "chore: bump plugin version to $VERSION"');
|
||||
|
||||
assert.ok(updateIndex >= 0, 'release.sh should update package version fields');
|
||||
assert.ok(packCheckIndex >= 0, 'release.sh should run build-opencode.test.js');
|
||||
assert.ok(commitIndex >= 0, 'release.sh should create the release commit');
|
||||
assert.ok(
|
||||
updateIndex < packCheckIndex,
|
||||
'build-opencode.test.js should run after versioned files are updated'
|
||||
);
|
||||
assert.ok(
|
||||
packCheckIndex < commitIndex,
|
||||
'build-opencode.test.js should run before the release commit is created'
|
||||
);
|
||||
})) passed++; else failed++;
|
||||
|
||||
console.log(`\nResults: Passed: ${passed}, Failed: ${failed}`);
|
||||
process.exit(failed > 0 ? 1 : 0);
|
||||
}
|
||||
|
||||
runTests();
|
||||
Reference in New Issue
Block a user