@carecard/validate 3.17.0 → 3.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/carecard-workspace-standards/SKILL.md +49 -20
- package/.agents/skills/github-pr-create-update/SKILL.md +22 -1
- package/.agents/skills/github-pr-merge-cleanup/SKILL.md +22 -1
- package/.agents/skills/logged-in-user-profile-page/SKILL.md +22 -1
- package/.agents/skills/pkg-publish/SKILL.md +22 -1
- package/.agents/skills/pkg-validate-coding-standards-and-best-practices/SKILL.md +47 -9
- package/.agents/skills/pkg-validate-validation-library/SKILL.md +45 -14
- package/.agents/skills/software-design-patterns-and-clean-code/SKILL.md +23 -3
- package/.codex/AGENTS.md +41 -10
- package/.github/workflows/auto-draft-pr.yml +173 -151
- package/.github/workflows/ci.yml +35 -32
- package/.husky/pre-commit +4 -4
- package/.prettierrc.js +10 -9
- package/AGENTS.md +19 -0
- package/eslint.config.mjs +60 -8
- package/index.d.ts +108 -107
- package/index.js +6 -6
- package/lib/validate.js +230 -157
- package/lib/validateNewUserRoleRequest.js +68 -60
- package/lib/validateProperties.js +326 -326
- package/lib/validateWhitelistProperties.js +182 -142
- package/lint-staged.config.mjs +36 -0
- package/package.json +66 -60
- package/readme.md +22 -1
- package/scripts/canonicalTestCommand.test.mjs +32 -0
- package/scripts/packageTaskRunner.audit.mjs +37 -0
- package/scripts/packageTaskRunner.test.mjs +64 -0
- package/scripts/runPackageTask.mjs +135 -0
- package/scripts/testOrder/randomizeTestOrder.cjs +35 -25
- package/scripts/testOrder/randomizeTestOrder.test.mjs +19 -19
- package/scripts/testOrder/testOrderPolicy.audit.mjs +54 -0
- package/scripts/testParallel/parallelTestPolicy.audit.mjs +63 -0
- package/scripts/testParallel/runIndexedMochaTests.cjs +45 -43
- package/scripts/testParallel/runIndexedMochaTests.test.mjs +13 -7
- package/scripts/testOrder/testOrderPolicy.test.mjs +0 -48
- package/scripts/testParallel/parallelTestPolicy.test.mjs +0 -39
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import { execFileSync } from 'node:child_process';
|
|
3
|
-
import { readFileSync } from 'node:fs';
|
|
4
|
-
import { test } from 'node:test';
|
|
5
|
-
|
|
6
|
-
const TEST_ORDER_INVARIANCE_RULE =
|
|
7
|
-
"Non-negotiable test order invariance rule: Every test must pass independently of which tests run before or after it, and the suite must pass in every execution order. Each test must establish the state it needs, isolate mutable state, and clean up state it owns; it must never rely on another test's setup, mutations, or cleanup. Default test, CI, and Husky commands must use the test framework's ordinary ordering and must not force randomized ordering. Random-order execution is an explicit diagnostic only, and every failure it exposes must be fixed at the root cause.";
|
|
8
|
-
|
|
9
|
-
function listRepositoryFiles() {
|
|
10
|
-
return execFileSync('git', ['ls-files', '--cached', '--others', '--exclude-standard'], { encoding: 'utf8' })
|
|
11
|
-
.trim()
|
|
12
|
-
.split('\n')
|
|
13
|
-
.filter(Boolean);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function isRequiredTestGuidance(filePath) {
|
|
17
|
-
return (
|
|
18
|
-
/^readme\.md$/i.test(filePath) ||
|
|
19
|
-
filePath === '.codex/AGENTS.md' ||
|
|
20
|
-
filePath === '.junie/guidelines.md' ||
|
|
21
|
-
filePath === '.agents/skills/carecard-workspace-standards/SKILL.md' ||
|
|
22
|
-
/^\.agents\/skills\/[^/]*(?:test|testing)[^/]*\/(?:SKILL\.md|references\/[^/]*(?:test|testing|coding-principles)[^/]*\.md)$/i.test(
|
|
23
|
-
filePath,
|
|
24
|
-
)
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
test('keeps the non-negotiable test order rule in repository guidance', () => {
|
|
29
|
-
const guidanceFiles = listRepositoryFiles().filter(isRequiredTestGuidance);
|
|
30
|
-
assert.ok(guidanceFiles.length > 0, 'No repository test guidance was found.');
|
|
31
|
-
|
|
32
|
-
for (const guidanceFile of guidanceFiles) {
|
|
33
|
-
const normalizedGuidance = readFileSync(guidanceFile, 'utf8').replace(/\s+/g, ' ').trim();
|
|
34
|
-
assert.ok(
|
|
35
|
-
normalizedGuidance.includes(TEST_ORDER_INVARIANCE_RULE),
|
|
36
|
-
`${guidanceFile} must document the non-negotiable test order invariance rule.`,
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
test('keeps default package scripts on the test framework ordinary ordering', () => {
|
|
42
|
-
const packageJson = JSON.parse(readFileSync('package.json', 'utf8'));
|
|
43
|
-
|
|
44
|
-
for (const [scriptName, command] of Object.entries(packageJson.scripts ?? {})) {
|
|
45
|
-
assert.equal(typeof command, 'string', `${scriptName} must be a string command.`);
|
|
46
|
-
assert.doesNotMatch(command, /--test-randomize|--test-random-seed/, `${scriptName} must not force randomized test ordering.`);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import { readdirSync, readFileSync } from 'node:fs';
|
|
3
|
-
import { createRequire } from 'node:module';
|
|
4
|
-
import { join, relative, resolve } from 'node:path';
|
|
5
|
-
import test from 'node:test';
|
|
6
|
-
|
|
7
|
-
const require = createRequire(import.meta.url);
|
|
8
|
-
const repositoryRoot = resolve(import.meta.dirname, '../..');
|
|
9
|
-
const packageJson = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url), 'utf8'));
|
|
10
|
-
const testIndexSource = readFileSync(new URL('../../test/index.test.js', import.meta.url), 'utf8');
|
|
11
|
-
const { parallelTestFiles } = require('../../test/index.test.js');
|
|
12
|
-
|
|
13
|
-
function listRuntimeTestFiles(directoryPath) {
|
|
14
|
-
return readdirSync(directoryPath, { withFileTypes: true }).flatMap(entry => {
|
|
15
|
-
const entryPath = join(directoryPath, entry.name);
|
|
16
|
-
if (entry.isDirectory()) return listRuntimeTestFiles(entryPath);
|
|
17
|
-
if (!/\.test\.(?:js|mjs)$/.test(entry.name) || entry.name === 'index.test.js') {
|
|
18
|
-
return [];
|
|
19
|
-
}
|
|
20
|
-
return [relative(repositoryRoot, entryPath)];
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
test('keeps runtime test selection in the index and package scripts short', () => {
|
|
25
|
-
assert.equal(packageJson.scripts.test, 'npm run test:order && node test/index.test.js');
|
|
26
|
-
assert.match(packageJson.scripts['test:coverage'], /nyc node test\/index\.test\.js$/);
|
|
27
|
-
assert.match(testIndexSource, /parallelTestFiles/);
|
|
28
|
-
assert.match(testIndexSource, /runIndexedMochaTests/);
|
|
29
|
-
assert.match(testIndexSource, /if \(require\.main === module\)/);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
test('runs the parallel execution contract in the test-order gate', () => {
|
|
33
|
-
assert.match(packageJson.scripts['test:order'], /scripts\/testParallel\/parallelTestPolicy\.test\.mjs/);
|
|
34
|
-
assert.match(packageJson.scripts['test:order'], /scripts\/testParallel\/runIndexedMochaTests\.test\.mjs/);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test('selects every runtime test file exactly once', () => {
|
|
38
|
-
assert.deepEqual([...parallelTestFiles].sort(), listRuntimeTestFiles(resolve(repositoryRoot, 'test')).sort());
|
|
39
|
-
});
|