uploadExclusions.test.mjs 874 Bytes
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import path from 'node:path';
import test from 'node:test';
import { fileURLToPath } from 'node:url';

const projectRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..');

test('upload configuration excludes migration docs, tests, and scripts', () => {
  const config = JSON.parse(readFileSync(path.join(projectRoot, 'project.config.json'), 'utf8'));
  const ignored = new Set((config.packOptions?.ignore || []).map(({ value }) => value));
  for (const directory of ['docs', 'tests', 'scripts']) {
    assert.ok(ignored.has(directory), `${directory} must be excluded from upload`);
  }

  const agentRules = (config.packOptions?.ignore || []).filter(
    ({ value }) => value === '.agents',
  );
  assert.deepEqual(agentRules, [{ value: '.agents', type: 'folder' }]);
});