Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .agents/skills/verify-dms-api/playground/node_modules

This file was deleted.

8 changes: 3 additions & 5 deletions .agents/skills/verify-dms-api/verify.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,14 @@ export interface VerifyConfig {
formal: FormalCheck[];
}

const SKILL = ".agents/skills/verify-dms-api";

const config: VerifyConfig = {
playground: `${SKILL}/playground`,
playground: "e2e/playground",
prepare: [
["pnpm", "install", "--frozen-lockfile", "--prefer-offline", "--ignore-scripts"],
["pnpm", "run", "build"],
["pnpm", "--dir", "playground", "install", "--ignore-workspace", "--frozen-lockfile", "--prefer-offline", "--ignore-scripts"],
["ln", "-sfn", "../../../../playground/node_modules", `${SKILL}/playground/node_modules`],
["node_modules/.bin/tsc", "-p", `${SKILL}/playground/tsconfig.build.json`],
["ln", "-sfn", "../../playground/node_modules", "e2e/playground/node_modules"],
["node_modules/.bin/tsc", "-p", "e2e/playground/tsconfig.build.json"],
],
userFacing: ["src/**", "frontend-vue/**", "skills/**", "package.json"],
notUserFacing: ["frontend-vue/tests/**", "frontend-vue/.*", "frontend-vue/eslint.config.mjs", "frontend-vue/vitest.config.ts", "frontend-vue/pnpm-lock.yaml"],
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,6 @@ e2e/blob-report
e2e/blob-reports

# What a backend of the verification playground writes when it starts
.agents/skills/verify-dms-api/playground/antelope-lock
.agents/skills/verify-dms-api/playground/.codex
.agents/skills/verify-dms-api/playground/.mcp.json
e2e/playground/antelope-lock
e2e/playground/.codex
e2e/playground/.mcp.json
16 changes: 16 additions & 0 deletions e2e/journeys.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { JourneysConfig } from "@antelopejs/dms/e2e";

export default {
playground: "e2e/playground",
prepare: [
[
"pnpm",
"install",
"--frozen-lockfile",
"--prefer-offline",
"--ignore-scripts",
],
["pnpm", "run", "e2e:build"],
],
smoke: "smoke",
} satisfies JourneysConfig;
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ function apiConfig(): z.infer<typeof apiOptions> {
* and the module's `@/` import alias applies to files under the folder the
* source names, so the source names the files' real folder.
*/
const moduleRoot = dirname(realpathSync(resolve(__dirname, "../../../../package.json")));
const moduleRoot = dirname(realpathSync(resolve(__dirname, "../../package.json")));

/**
* The repository's playground with the ports, origins, secrets and mail
* `dms-control` sets for a run, a fixture module (`app`) and the module under
* the e2e kit sets for a run, a fixture module (`app`) and the module under
* verification built from the checkout.
*/
export default defineConfig({
Expand Down
1 change: 1 addition & 0 deletions e2e/playground/node_modules
8 changes: 8 additions & 0 deletions e2e/playground/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.build.json",
"compilerOptions": {
"rootDir": ".",
"noEmit": true
},
"include": ["./src/**/*.ts", "./antelope.config.ts"]
}
3 changes: 2 additions & 1 deletion oxfmt.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { antelopeFmtPreset } from "@antelopejs/tooling-configs/oxc/fmt";

/** Prettier formats the Vue layer; Markdown was never machine-formatted here; the journeys and their helpers keep the layout they had in the verify skill. */
/** Prettier formats the Vue layer; Markdown was never machine-formatted here; the journeys, their helpers and their playground are hand-formatted. */
export default antelopeFmtPreset({
ignorePatterns: [
"frontend-vue/**",
"**/*.md",
"**/*.vue",
"e2e/journeys/**",
"e2e/playground/**",
"e2e/*.mjs",
"e2e/*.cjs",
],
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"build": "rimraf dist && tsc",
"dev": "ajs project dev -w -p playground",
"e2e": "playwright test -c e2e",
"e2e:build": "pnpm run build && pnpm --dir playground install --ignore-workspace --frozen-lockfile --prefer-offline --ignore-scripts && ln -sfn ../../../../playground/node_modules .agents/skills/verify-dms-api/playground/node_modules && tsc -p .agents/skills/verify-dms-api/playground/tsconfig.build.json",
"e2e:build": "pnpm run build && pnpm --dir playground install --ignore-workspace --frozen-lockfile --prefer-offline --ignore-scripts && ln -sfn ../../playground/node_modules e2e/playground/node_modules && tsc -p e2e/playground/tsconfig.build.json",
"lint:fix": "oxlint --fix --max-warnings=1000000 && oxfmt . && pnpm --dir frontend-vue lint:fix",
"lint": "oxlint && pnpm --dir frontend-vue lint",
"typecheck": "tsc -p tests",
Expand Down Expand Up @@ -67,7 +67,7 @@
},
"devDependencies": {
"@antelopejs/core": "~1.24.5",
"@antelopejs/dms": "0.21.4-next.939.g641c7fa",
"@antelopejs/dms": "0.21.4-next.944.g3da5606",
"@antelopejs/dms-frontend": ">=0.11.8 <0.12.0",
"@antelopejs/interface-data-api": ">=0.8.0 <0.9.0",
"@antelopejs/tooling-configs": ">=0.8.9 <0.9.0",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions tests/helpers/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ import { join, resolve } from "node:path";
import { z } from "zod";

/** The verification playground: the fixture app, dms-api from this checkout, the DMS, MongoDB and auth modules. */
export const PLAYGROUND = resolve(
__dirname,
"../../.agents/skills/verify-dms-api/playground",
);
export const PLAYGROUND = resolve(__dirname, "../../e2e/playground");

const READY_TIMEOUT_MS = 90_000;
const POLL_MS = 250;
Expand Down
13 changes: 10 additions & 3 deletions tests/helpers/dms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,20 @@ export class Dms {

/**
* Sends one call to the project's routes and reads back the request log
* it made, found by its `x-request-id` or by its method and path.
* it made, found by its `x-request-id` or by its method and path among
* the logs written after the call.
*/
async sendAndRead(request: {
method?: string;
path: string;
headers?: HeadersInit;
body?: string;
}): Promise<{ status: number; log: Json }> {
const earlier = new Set(
resultsOf((await this.mon("/logs?limit=50")).body, loggedSchema).map(
(entry) => entry._id,
),
);
const sent = await this.raw(request);
const path = request.path.split("?")[0];
const method = request.method ?? "GET";
Expand All @@ -280,8 +286,9 @@ export class Dms {
const listed = await this.mon("/logs?limit=50");
const row = resultsOf(listed.body, loggedSchema).find(
(entry) =>
(requestId !== null && entry.requestId === requestId) ||
(entry.path === path && entry.method === method),
!earlier.has(entry._id) &&
((requestId !== null && entry.requestId === requestId) ||
(entry.path === path && entry.method === method)),
);
if (row)
return {
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/journeys-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default async function setup(project: {
provide: (key: "mongoUrl", value: string) => void;
}): Promise<() => Promise<void>> {
for (const built of [
join(PLAYGROUND, "../../../../dist/index.js"),
join(PLAYGROUND, "../../dist/index.js"),
join(PLAYGROUND, "dist/index.js"),
]) {
if (!existsSync(built))
Expand Down
25 changes: 23 additions & 2 deletions tests/helpers/package.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { execFileSync } from "node:child_process";
import { existsSync, readFileSync } from "node:fs";
import { existsSync, readdirSync, readFileSync } from "node:fs";
import { createRequire } from "node:module";
import { join } from "node:path";
import { basename, join } from "node:path";
import { pathToFileURL } from "node:url";
import { z } from "zod";

const ROOT = join(__dirname, "..", "..");
Expand Down Expand Up @@ -109,3 +110,23 @@ export function localeKeys(file: string): string[] {
JSON.parse(readText(`frontend-vue/i18n/locales/${file}`)),
);
}

const journeysModuleSchema = z.object({
journeys: z.array(z.object({ id: z.string() })),
});

/** Each feature of `e2e/journeys/`, named after its file, mapped to the ids of the journeys it exports. */
export async function journeyFeatures(): Promise<Map<string, string[]>> {
const folder = join(ROOT, "e2e", "journeys");
const files = readdirSync(folder).filter((file) => file.endsWith(".mjs"));
const features = await Promise.all(
files.map(async (file) => {
const module: unknown = await import(
pathToFileURL(join(folder, file)).href
);
const { journeys } = journeysModuleSchema.parse(module);
return [basename(file, ".mjs"), journeys.map(({ id }) => id)] as const;
}),
);
return new Map(features);
}
11 changes: 7 additions & 4 deletions tests/package.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { satisfies } from "semver";
import { beforeAll, describe, expect, it } from "vitest";
import journeysConfig from "../e2e/journeys.config";
import {
exists,
installedVersion,
journeyFeatures,
localeKeys,
manifest,
packedFiles,
readText,
rendererRange,
run,
skillCases,
} from "./helpers/package";

Expand Down Expand Up @@ -143,8 +144,10 @@ describe("the docs and the locales", () => {
});
});

describe("the verify feature map", () => {
it("covers every user-facing file, and every feature has its journeys", () => {
expect(() => run("pnpm", ["exec", "dms-control", "map"])).not.toThrow();
describe("the e2e journeys", () => {
it("export a journeys list per feature, and journeys for the smoke feature", async () => {
const features = await journeyFeatures();

expect(features.get(journeysConfig.smoke)?.length).toBeGreaterThan(0);
});
});
Loading