uploadExclusions.test.mjs
1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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 development and agent metadata', () => {
const config = JSON.parse(readFileSync(path.join(projectRoot, 'project.config.json'), 'utf8'));
const ignored = new Set((config.packOptions?.ignore || []).map(({ value }) => value));
for (const entry of [
'docs',
'tests',
'scripts',
'.codex-tmp',
'outputs',
'.agents',
'.github',
'AGENTS.md',
]) {
assert.ok(ignored.has(entry), `${entry} must be excluded from upload`);
}
for (const retiredEntry of ['.cursor', '.cloudbase']) {
assert.equal(
ignored.has(retiredEntry),
false,
`${retiredEntry} must not remain as a stale exclusion`,
);
}
});
test('local agent artifacts are ignored at repository root', () => {
const gitignore = readFileSync(path.join(projectRoot, '.gitignore'), 'utf8');
assert.match(gitignore, /^\/\.codex-tmp\/$/m);
assert.match(gitignore, /^\/\.superpowers\/$/m);
});
test('development compilation excludes unreferenced Node-only scripts', () => {
for (const configFile of ['project.config.json', 'project.private.config.json']) {
const config = JSON.parse(readFileSync(path.join(projectRoot, configFile), 'utf8'));
assert.equal(
config.setting?.ignoreDevUnusedFiles,
true,
`${configFile} must not compile unreferenced Node-only test and script files`,
);
}
});