@synoikia/core 0.16.0 → 0.17.1
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/dist/testing/compliance/config.d.ts +19 -0
- package/dist/testing/compliance/config.js +50 -0
- package/dist/testing/compliance/config.js.map +1 -0
- package/dist/testing/compliance/index.d.ts +5 -0
- package/dist/testing/compliance/index.js +3 -0
- package/dist/testing/compliance/index.js.map +1 -0
- package/dist/testing/compliance/profile.d.ts +62 -0
- package/dist/testing/compliance/profile.js +58 -0
- package/dist/testing/compliance/profile.js.map +1 -0
- package/dist/testing/compliance/run.d.ts +19 -0
- package/dist/testing/compliance/run.js +12 -0
- package/dist/testing/compliance/run.js.map +1 -0
- package/dist/testing/compliance/steps.d.ts +1 -0
- package/dist/testing/compliance/steps.js +469 -0
- package/dist/testing/compliance/steps.js.map +1 -0
- package/dist/testing/compliance/suite/access.feature +20 -0
- package/dist/testing/compliance/suite/catalog.feature +19 -0
- package/dist/testing/compliance/suite/connection-secrets.feature +10 -0
- package/dist/testing/compliance/suite/guides.feature +11 -0
- package/dist/testing/compliance/suite/lock-cases.feature +10 -0
- package/dist/testing/compliance/suite/locks.feature +21 -0
- package/dist/testing/compliance/suite/secrets.feature +24 -0
- package/dist/testing/compliance/verdict.d.ts +12 -0
- package/dist/testing/compliance/verdict.js +56 -0
- package/dist/testing/compliance/verdict.js.map +1 -0
- package/dist/testing/index.d.ts +2 -2
- package/dist/testing/index.js +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/repository.d.ts +2 -0
- package/dist/testing/repository.js +1 -1
- package/dist/testing/repository.js.map +1 -1
- package/package.json +26 -3
- package/dist/testing/contract.d.ts +0 -25
- package/dist/testing/contract.js +0 -81
- package/dist/testing/contract.js.map +0 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ViteUserConfig } from 'vitest/config';
|
|
2
|
+
/** The shipped compliance suite: the feature files of core's rules for plugins. */
|
|
3
|
+
export declare const SUITE_DIR: string;
|
|
4
|
+
export interface ComplianceOptions {
|
|
5
|
+
/** The plugin package directory, holding `manifest.json`, the built entry and `test/compliance.yaml`. */
|
|
6
|
+
pluginDir: string;
|
|
7
|
+
/** The plugin's own feature files, relative to `pluginDir`. */
|
|
8
|
+
features?: string[];
|
|
9
|
+
/** Step files for the plugin's own feature files, relative to `pluginDir`. */
|
|
10
|
+
steps?: string[];
|
|
11
|
+
}
|
|
12
|
+
declare module 'vitest' {
|
|
13
|
+
interface ProvidedContext {
|
|
14
|
+
synoikiaPluginDir: string;
|
|
15
|
+
synoikiaFeatureFiles: number;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/** The vitest config that runs the compliance suite and the plugin's own feature files, and prints core's verdict. */
|
|
19
|
+
export declare function complianceConfig(opts: ComplianceOptions): ViteUserConfig;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { globSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { quickpickle } from 'quickpickle';
|
|
5
|
+
import { VerdictReporter } from './verdict.js';
|
|
6
|
+
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
/** The shipped compliance suite: the feature files of core's rules for plugins. */
|
|
8
|
+
export const SUITE_DIR = path.join(HERE, 'suite');
|
|
9
|
+
const STEPS = path.join(HERE, `steps${path.extname(fileURLToPath(import.meta.url))}`);
|
|
10
|
+
/** The vitest config that runs the compliance suite and the plugin's own feature files, and prints core's verdict. */
|
|
11
|
+
export function complianceConfig(opts) {
|
|
12
|
+
const pluginDir = path.resolve(opts.pluginDir);
|
|
13
|
+
const features = opts.features ?? ['features/**/*.feature'];
|
|
14
|
+
const files = [
|
|
15
|
+
...globSync('*.feature', { cwd: SUITE_DIR }),
|
|
16
|
+
...globSync(features, { cwd: pluginDir, exclude: (f) => f === 'node_modules' }),
|
|
17
|
+
];
|
|
18
|
+
return {
|
|
19
|
+
plugins: [quickpickle({ todoTags: ['@todo', '@wip', '@backlog'], stepTimeout: 60_000 })],
|
|
20
|
+
test: {
|
|
21
|
+
reporters: ['default', new VerdictReporter(pluginDir, SUITE_DIR)],
|
|
22
|
+
projects: [
|
|
23
|
+
{
|
|
24
|
+
extends: true,
|
|
25
|
+
test: {
|
|
26
|
+
name: 'compliance',
|
|
27
|
+
root: pluginDir,
|
|
28
|
+
include: [path.join(SUITE_DIR, '*.feature'), ...features],
|
|
29
|
+
// Only feature files: the repo's own include of test files would run them in this process too.
|
|
30
|
+
exclude: ['**/*.test.ts', '**/*.spec.ts'],
|
|
31
|
+
setupFiles: [STEPS, ...(opts.steps ?? []).map((s) => path.resolve(pluginDir, s))],
|
|
32
|
+
provide: { synoikiaPluginDir: pluginDir, synoikiaFeatureFiles: files.length },
|
|
33
|
+
// Vitest runs the suite's own modules, so the fake module the profile names loads like a test file.
|
|
34
|
+
server: { deps: { inline: [/@synoikia[\\/]core[\\/]dist[\\/]testing[\\/]compliance/] } },
|
|
35
|
+
// One process runs the feature files one after another, so the plugin boots once for the run.
|
|
36
|
+
isolate: false,
|
|
37
|
+
fileParallelism: false,
|
|
38
|
+
// Its own group, after the plugin's other projects: vitest needs one for a project of one worker.
|
|
39
|
+
sequence: { groupOrder: 1 },
|
|
40
|
+
// isolated-vm requires --no-node-snapshot on Node >= 20.
|
|
41
|
+
execArgv: ['--no-node-snapshot'],
|
|
42
|
+
testTimeout: 120_000,
|
|
43
|
+
hookTimeout: 120_000,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/testing/compliance/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,IAAI,MAAM,WAAW,CAAC;AA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C,CAAC;YACjE,QAAQ,EAAE;gBACR;oBACE,OAAO,EAAE,IAAI;oBACb,IAAI,EAAE;wBACJ,IAAI,EAAE,YAAY;wBAClB,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,EAAE,GAAG,QAAQ,CAAC;wBACzD,+FAA+F;wBAC/F,OAAO,EAAE,CAAC,cAAc,EAAE,cAAc,CAAC;wBACzC,UAAU,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;wBACjF,OAAO,EAAE,EAAE,iBAAiB,EAAE,SAAS,EAAE,oBAAoB,EAAE,KAAK,CAAC,MAAM,EAAE;wBAC7E,oGAAoG;wBACpG,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,wDAAwD,CAAC,EAAE,EAAE;wBACxF,8FAA8F;wBAC9F,OAAO,EAAE,KAAK;wBACd,eAAe,EAAE,KAAK;wBACtB,kGAAkG;wBAClG,QAAQ,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE;wBAC3B,yDAAyD;wBACzD,QAAQ,EAAE,CAAC,oBAAoB,CAAC;wBAChC,WAAW,EAAE,OAAO;wBACpB,WAAW,EAAE,OAAO;qBACrB;iBACF;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { complianceConfig, SUITE_DIR } from './config.js';
|
|
2
|
+
export type { ComplianceOptions } from './config.js';
|
|
3
|
+
export type { ComplianceCall, ComplianceFake, ComplianceProfile } from './profile.js';
|
|
4
|
+
export { complianceSubject } from './run.js';
|
|
5
|
+
export type { ComplianceSubject } from './run.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/compliance/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** `test/compliance.yaml` of a plugin: what the compliance suite needs to check it against core's rules. */
|
|
3
|
+
declare const Call: z.ZodObject<{
|
|
4
|
+
fn: z.ZodString;
|
|
5
|
+
args: z.ZodDefault<z.ZodArray<z.ZodUnknown>>;
|
|
6
|
+
key: z.ZodOptional<z.ZodString>;
|
|
7
|
+
}, z.core.$strict>;
|
|
8
|
+
declare const ProfileSchema: z.ZodObject<{
|
|
9
|
+
fake: z.ZodOptional<z.ZodString>;
|
|
10
|
+
connection: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
11
|
+
reads: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
12
|
+
fn: z.ZodString;
|
|
13
|
+
args: z.ZodDefault<z.ZodArray<z.ZodUnknown>>;
|
|
14
|
+
key: z.ZodOptional<z.ZodString>;
|
|
15
|
+
}, z.core.$strict>>>;
|
|
16
|
+
writes: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
17
|
+
fn: z.ZodString;
|
|
18
|
+
args: z.ZodDefault<z.ZodArray<z.ZodUnknown>>;
|
|
19
|
+
key: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, z.core.$strict>>>;
|
|
21
|
+
rejects: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
22
|
+
fn: z.ZodString;
|
|
23
|
+
args: z.ZodDefault<z.ZodArray<z.ZodUnknown>>;
|
|
24
|
+
}, z.core.$strict>>>;
|
|
25
|
+
locks: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
26
|
+
fn: z.ZodString;
|
|
27
|
+
args: z.ZodDefault<z.ZodArray<z.ZodUnknown>>;
|
|
28
|
+
key: z.ZodOptional<z.ZodString>;
|
|
29
|
+
confirm: z.ZodString;
|
|
30
|
+
target: z.ZodOptional<z.ZodString>;
|
|
31
|
+
}, z.core.$strict>>>;
|
|
32
|
+
secrets: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
33
|
+
fn: z.ZodString;
|
|
34
|
+
args: z.ZodDefault<z.ZodArray<z.ZodUnknown>>;
|
|
35
|
+
key: z.ZodOptional<z.ZodString>;
|
|
36
|
+
values: z.ZodArray<z.ZodString>;
|
|
37
|
+
}, z.core.$strict>>>;
|
|
38
|
+
connectionTest: z.ZodOptional<z.ZodObject<{
|
|
39
|
+
wrong: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
40
|
+
}, z.core.$strict>>;
|
|
41
|
+
calls: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
42
|
+
fn: z.ZodString;
|
|
43
|
+
args: z.ZodDefault<z.ZodArray<z.ZodUnknown>>;
|
|
44
|
+
key: z.ZodOptional<z.ZodString>;
|
|
45
|
+
}, z.core.$strict>>>;
|
|
46
|
+
}, z.core.$strict>;
|
|
47
|
+
export type ComplianceProfile = z.infer<typeof ProfileSchema>;
|
|
48
|
+
export type ComplianceCall = z.infer<typeof Call>;
|
|
49
|
+
/** What the module named by `fake` starts: the fake upstream, with `url` and any other `${fake.<name>}` values. */
|
|
50
|
+
export interface ComplianceFake {
|
|
51
|
+
url: string;
|
|
52
|
+
close(): unknown;
|
|
53
|
+
reset?(): unknown;
|
|
54
|
+
[name: string]: unknown;
|
|
55
|
+
}
|
|
56
|
+
export declare const PROFILE_FILE: string;
|
|
57
|
+
/** Reads the profile, starts its fake upstream and puts the fake's values in place of each `${fake.<name>}`. */
|
|
58
|
+
export declare function loadProfile(pluginDir: string): Promise<{
|
|
59
|
+
profile: ComplianceProfile;
|
|
60
|
+
fake?: ComplianceFake;
|
|
61
|
+
}>;
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { pathToFileURL } from 'node:url';
|
|
4
|
+
import { parse } from 'yaml';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
/** `test/compliance.yaml` of a plugin: what the compliance suite needs to check it against core's rules. */
|
|
7
|
+
const Call = z.strictObject({ fn: z.string(), args: z.array(z.unknown()).default([]), key: z.string().optional() });
|
|
8
|
+
const ProfileSchema = z.strictObject({
|
|
9
|
+
fake: z.string().optional(),
|
|
10
|
+
connection: z.record(z.string(), z.unknown()),
|
|
11
|
+
reads: z.array(Call).default([]),
|
|
12
|
+
writes: z.array(Call).default([]),
|
|
13
|
+
rejects: z.array(Call.omit({ key: true })).default([]),
|
|
14
|
+
locks: z.record(z.string(), Call.extend({ confirm: z.string(), target: z.string().optional() })).default({}),
|
|
15
|
+
secrets: z.array(Call.extend({ values: z.array(z.string()) })).default([]),
|
|
16
|
+
connectionTest: z.strictObject({ wrong: z.record(z.string(), z.unknown()) }).optional(),
|
|
17
|
+
calls: z.record(z.string(), Call).default({}),
|
|
18
|
+
});
|
|
19
|
+
export const PROFILE_FILE = path.join('test', 'compliance.yaml');
|
|
20
|
+
/** Reads the profile, starts its fake upstream and puts the fake's values in place of each `${fake.<name>}`. */
|
|
21
|
+
export async function loadProfile(pluginDir) {
|
|
22
|
+
const file = path.join(pluginDir, PROFILE_FILE);
|
|
23
|
+
const parsed = ProfileSchema.safeParse(parse(readFileSync(file, 'utf8')));
|
|
24
|
+
if (!parsed.success)
|
|
25
|
+
throw new Error(`${PROFILE_FILE}: ${z.prettifyError(parsed.error)}`);
|
|
26
|
+
const fake = parsed.data.fake ? await startFake(pluginDir, parsed.data.fake) : undefined;
|
|
27
|
+
return { profile: fill(parsed.data, fake ?? { url: '', close: () => undefined }), fake };
|
|
28
|
+
}
|
|
29
|
+
async function startFake(pluginDir, module) {
|
|
30
|
+
const mod = (await import(pathToFileURL(path.resolve(pluginDir, module)).href));
|
|
31
|
+
const start = mod.start ?? mod.default?.start;
|
|
32
|
+
if (!start)
|
|
33
|
+
throw new Error(`${module} exports no start()`);
|
|
34
|
+
const fake = await start();
|
|
35
|
+
if (typeof fake?.url !== 'string')
|
|
36
|
+
throw new Error(`${module}: start() returned no url`);
|
|
37
|
+
return fake;
|
|
38
|
+
}
|
|
39
|
+
const PLACEHOLDER = /\$\{fake\.([A-Za-z0-9_]+)\}/g;
|
|
40
|
+
function fill(value, fake) {
|
|
41
|
+
if (typeof value === 'string') {
|
|
42
|
+
const whole = /^\$\{fake\.([A-Za-z0-9_]+)\}$/.exec(value);
|
|
43
|
+
if (whole)
|
|
44
|
+
return valueOf(fake, whole[1]);
|
|
45
|
+
return value.replace(PLACEHOLDER, (_m, name) => String(valueOf(fake, name)));
|
|
46
|
+
}
|
|
47
|
+
if (Array.isArray(value))
|
|
48
|
+
return value.map((v) => fill(v, fake));
|
|
49
|
+
if (value && typeof value === 'object')
|
|
50
|
+
return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, fill(v, fake)]));
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
function valueOf(fake, name) {
|
|
54
|
+
if (!(name in fake))
|
|
55
|
+
throw new Error(`${PROFILE_FILE}: the fake has no value "${name}"`);
|
|
56
|
+
return fake[name];
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../../src/testing/compliance/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,4GAA4G;AAE5G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AAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACvF,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,OAAO,CAAC,IAAoB,EAAE,IAAY;IACjD,IAAI,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,YAAY,4BAA4B,IAAI,GAAG,CAAC,CAAC;IACzF,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PluginHarness } from '../index.js';
|
|
2
|
+
import type { ComplianceFake, ComplianceProfile } from './profile.js';
|
|
3
|
+
/** The plugin under test in a compliance run: its profile, its fake and core's harness. */
|
|
4
|
+
export interface ComplianceSubject {
|
|
5
|
+
pluginDir: string;
|
|
6
|
+
profile: ComplianceProfile;
|
|
7
|
+
fake?: ComplianceFake;
|
|
8
|
+
harness: PluginHarness;
|
|
9
|
+
}
|
|
10
|
+
/** What the feature files of one run share, kept on `globalThis` because the steps load once for each file. */
|
|
11
|
+
export interface ComplianceRun {
|
|
12
|
+
ended: number;
|
|
13
|
+
subject(): Promise<ComplianceSubject>;
|
|
14
|
+
stop(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export declare const currentRun: () => ComplianceRun | undefined;
|
|
17
|
+
export declare const startRun: (run: ComplianceRun) => ComplianceRun;
|
|
18
|
+
/** The plugin under test, for the step files of a plugin's own feature files. */
|
|
19
|
+
export declare function complianceSubject(): Promise<ComplianceSubject>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const RUN = Symbol.for('synoikia.compliance.run');
|
|
2
|
+
const holder = globalThis;
|
|
3
|
+
export const currentRun = () => holder[RUN];
|
|
4
|
+
export const startRun = (run) => (holder[RUN] ??= run);
|
|
5
|
+
/** The plugin under test, for the step files of a plugin's own feature files. */
|
|
6
|
+
export function complianceSubject() {
|
|
7
|
+
const run = currentRun();
|
|
8
|
+
if (!run)
|
|
9
|
+
throw new Error('complianceSubject() works only in a run of complianceConfig()');
|
|
10
|
+
return run.subject();
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/testing/compliance/run.ts"],"names":[],"mappings":"AAkBA,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AAClD,MAAM,MAAM,GAAG,UAAuC,CAAC;AAEvD,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC5C,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAkB,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;AAEtE,iFAAiF;AACjF,MAAM,UAAU,iBAAiB;IAC/B,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;IACzB,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;IAC3F,OAAO,GAAG,CAAC,OAAO,EAAE,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|