ddd-ts-kit 0.23.1 → 0.24.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/CHANGELOG.md +37 -0
- package/README.fr.md +42 -7
- package/README.md +38 -6
- package/dist/check/canonical/stray-entry.d.ts +8 -0
- package/dist/check/canonical/stray-entry.d.ts.map +1 -0
- package/dist/check/canonical/stray-entry.js +75 -0
- package/dist/check/canonical/stray-entry.js.map +1 -0
- package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
- package/dist/check/catalogue/architecture-rules.js +2 -0
- package/dist/check/catalogue/architecture-rules.js.map +1 -1
- package/dist/check/catalogue/default-severities.d.ts.map +1 -1
- package/dist/check/catalogue/default-severities.js +1 -0
- package/dist/check/catalogue/default-severities.js.map +1 -1
- package/dist/check/explain/persistence-docs.js +1 -1
- package/dist/check/explain/persistence-docs.js.map +1 -1
- package/dist/check/explain/tree-docs.d.ts.map +1 -1
- package/dist/check/explain/tree-docs.js +5 -0
- package/dist/check/explain/tree-docs.js.map +1 -1
- package/dist/check/fixtures/tree-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/tree-fixtures.js +17 -0
- package/dist/check/fixtures/tree-fixtures.js.map +1 -1
- package/dist/check/migrations/drizzle-history-findings.js +1 -1
- package/dist/check/migrations/drizzle-history-findings.js.map +1 -1
- package/dist/check/rules/tree-closed.d.ts.map +1 -1
- package/dist/check/rules/tree-closed.js +4 -68
- package/dist/check/rules/tree-closed.js.map +1 -1
- package/dist/check/rules/tree-documented-paths.d.ts +3 -0
- package/dist/check/rules/tree-documented-paths.d.ts.map +1 -0
- package/dist/check/rules/tree-documented-paths.js +54 -0
- package/dist/check/rules/tree-documented-paths.js.map +1 -0
- package/dist/commands/drizzle-generate.d.ts +6 -1
- package/dist/commands/drizzle-generate.d.ts.map +1 -1
- package/dist/commands/drizzle-generate.js +39 -6
- package/dist/commands/drizzle-generate.js.map +1 -1
- package/dist/commands/plan-waves.d.ts +9 -0
- package/dist/commands/plan-waves.d.ts.map +1 -0
- package/dist/commands/plan-waves.js +36 -0
- package/dist/commands/plan-waves.js.map +1 -0
- package/dist/commands/status.d.ts +1 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +4 -2
- package/dist/commands/status.js.map +1 -1
- package/dist/help/notes.d.ts +1 -1
- package/dist/help/notes.d.ts.map +1 -1
- package/dist/help/notes.js +19 -3
- package/dist/help/notes.js.map +1 -1
- package/dist/help/usage.d.ts +1 -1
- package/dist/help/usage.d.ts.map +1 -1
- package/dist/help/usage.js +2 -0
- package/dist/help/usage.js.map +1 -1
- package/dist/init/files/persistence-files.d.ts.map +1 -1
- package/dist/init/files/persistence-files.js +7 -1
- package/dist/init/files/persistence-files.js.map +1 -1
- package/dist/init/manifest/versions.js +24 -24
- package/dist/migration/branch-migration.d.ts +9 -0
- package/dist/migration/branch-migration.d.ts.map +1 -0
- package/dist/migration/branch-migration.js +2 -0
- package/dist/migration/branch-migration.js.map +1 -0
- package/dist/migration/branch-migrations.d.ts +16 -0
- package/dist/migration/branch-migrations.d.ts.map +1 -0
- package/dist/migration/branch-migrations.js +48 -0
- package/dist/migration/branch-migrations.js.map +1 -0
- package/dist/migration/delete-branch-migrations.d.ts +9 -0
- package/dist/migration/delete-branch-migrations.d.ts.map +1 -0
- package/dist/migration/delete-branch-migrations.js +23 -0
- package/dist/migration/delete-branch-migrations.js.map +1 -0
- package/dist/migration/drizzle-run.d.ts +7 -0
- package/dist/migration/drizzle-run.d.ts.map +1 -0
- package/dist/migration/drizzle-run.js +2 -0
- package/dist/migration/drizzle-run.js.map +1 -0
- package/dist/migration/drizzle-silent-failures.js +1 -1
- package/dist/migration/drizzle-silent-failures.js.map +1 -1
- package/dist/migration/find-project-formatter.d.ts +8 -0
- package/dist/migration/find-project-formatter.d.ts.map +1 -0
- package/dist/migration/find-project-formatter.js +52 -0
- package/dist/migration/find-project-formatter.js.map +1 -0
- package/dist/migration/format-written-files.d.ts +9 -0
- package/dist/migration/format-written-files.d.ts.map +1 -0
- package/dist/migration/format-written-files.js +32 -0
- package/dist/migration/format-written-files.js.map +1 -0
- package/dist/migration/generate-and-read.d.ts +6 -0
- package/dist/migration/generate-and-read.d.ts.map +1 -0
- package/dist/migration/generate-and-read.js +14 -0
- package/dist/migration/generate-and-read.js.map +1 -0
- package/dist/migration/index.d.ts +4 -0
- package/dist/migration/index.d.ts.map +1 -1
- package/dist/migration/index.js +4 -0
- package/dist/migration/index.js.map +1 -1
- package/dist/migration/known-primary-keys.d.ts +3 -0
- package/dist/migration/known-primary-keys.d.ts.map +1 -0
- package/dist/migration/known-primary-keys.js +2 -0
- package/dist/migration/known-primary-keys.js.map +1 -0
- package/dist/migration/migration-files.d.ts +7 -0
- package/dist/migration/migration-files.d.ts.map +1 -0
- package/dist/migration/migration-files.js +29 -0
- package/dist/migration/migration-files.js.map +1 -0
- package/dist/migration/plan-replay.d.ts +9 -0
- package/dist/migration/plan-replay.d.ts.map +1 -0
- package/dist/migration/plan-replay.js +68 -0
- package/dist/migration/plan-replay.js.map +1 -0
- package/dist/migration/previous-primary-keys.d.ts +9 -0
- package/dist/migration/previous-primary-keys.d.ts.map +1 -0
- package/dist/migration/previous-primary-keys.js +55 -0
- package/dist/migration/previous-primary-keys.js.map +1 -0
- package/dist/migration/primary-key-order-finding.d.ts +12 -0
- package/dist/migration/primary-key-order-finding.d.ts.map +1 -0
- package/dist/migration/primary-key-order-finding.js +2 -0
- package/dist/migration/primary-key-order-finding.js.map +1 -0
- package/dist/migration/primary-key-order-findings.d.ts +12 -0
- package/dist/migration/primary-key-order-findings.d.ts.map +1 -0
- package/dist/migration/primary-key-order-findings.js +55 -0
- package/dist/migration/primary-key-order-findings.js.map +1 -0
- package/dist/migration/project-formatter.d.ts +9 -0
- package/dist/migration/project-formatter.d.ts.map +1 -0
- package/dist/migration/project-formatter.js +2 -0
- package/dist/migration/project-formatter.js.map +1 -0
- package/dist/migration/replay-drizzle-migrations.d.ts +15 -0
- package/dist/migration/replay-drizzle-migrations.d.ts.map +1 -0
- package/dist/migration/replay-drizzle-migrations.js +63 -0
- package/dist/migration/replay-drizzle-migrations.js.map +1 -0
- package/dist/migration/replay-plan.d.ts +11 -0
- package/dist/migration/replay-plan.d.ts.map +1 -0
- package/dist/migration/replay-plan.js +2 -0
- package/dist/migration/replay-plan.js.map +1 -0
- package/dist/migration/replayed-name.d.ts +7 -0
- package/dist/migration/replayed-name.d.ts.map +1 -0
- package/dist/migration/replayed-name.js +12 -0
- package/dist/migration/replayed-name.js.map +1 -0
- package/dist/migration/sql-statement.d.ts +6 -0
- package/dist/migration/sql-statement.d.ts.map +1 -0
- package/dist/migration/sql-statement.js +2 -0
- package/dist/migration/sql-statement.js.map +1 -0
- package/dist/migration/sql-statements.d.ts +4 -0
- package/dist/migration/sql-statements.d.ts.map +1 -0
- package/dist/migration/sql-statements.js +36 -0
- package/dist/migration/sql-statements.js.map +1 -0
- package/dist/migration/table-change.d.ts +12 -0
- package/dist/migration/table-change.d.ts.map +1 -0
- package/dist/migration/table-change.js +2 -0
- package/dist/migration/table-change.js.map +1 -0
- package/dist/migration/table-changes.d.ts +9 -0
- package/dist/migration/table-changes.d.ts.map +1 -0
- package/dist/migration/table-changes.js +55 -0
- package/dist/migration/table-changes.js.map +1 -0
- package/dist/migration/tidy-written-migration.d.ts +5 -0
- package/dist/migration/tidy-written-migration.d.ts.map +1 -0
- package/dist/migration/tidy-written-migration.js +8 -0
- package/dist/migration/tidy-written-migration.js.map +1 -0
- package/dist/migration/wait-for-next-second.d.ts +6 -0
- package/dist/migration/wait-for-next-second.d.ts.map +1 -0
- package/dist/migration/wait-for-next-second.js +11 -0
- package/dist/migration/wait-for-next-second.js.map +1 -0
- package/dist/migration/warn-primary-key-order.d.ts +5 -0
- package/dist/migration/warn-primary-key-order.d.ts.map +1 -0
- package/dist/migration/warn-primary-key-order.js +16 -0
- package/dist/migration/warn-primary-key-order.js.map +1 -0
- package/dist/migration/written-migration.d.ts +9 -0
- package/dist/migration/written-migration.d.ts.map +1 -0
- package/dist/migration/written-migration.js +2 -0
- package/dist/migration/written-migration.js.map +1 -0
- package/dist/migration/written-paths.d.ts +3 -0
- package/dist/migration/written-paths.d.ts.map +1 -0
- package/dist/migration/written-paths.js +5 -0
- package/dist/migration/written-paths.js.map +1 -0
- package/dist/plan/aggregates-of.d.ts +6 -0
- package/dist/plan/aggregates-of.d.ts.map +1 -0
- package/dist/plan/aggregates-of.js +13 -0
- package/dist/plan/aggregates-of.js.map +1 -0
- package/dist/plan/batched-waves.d.ts +18 -0
- package/dist/plan/batched-waves.d.ts.map +1 -0
- package/dist/plan/batched-waves.js +73 -0
- package/dist/plan/batched-waves.js.map +1 -0
- package/dist/plan/cycles-of.d.ts +8 -0
- package/dist/plan/cycles-of.d.ts.map +1 -0
- package/dist/plan/cycles-of.js +30 -0
- package/dist/plan/cycles-of.js.map +1 -0
- package/dist/plan/format-plan.d.ts +4 -0
- package/dist/plan/format-plan.d.ts.map +1 -0
- package/dist/plan/format-plan.js +53 -0
- package/dist/plan/format-plan.js.map +1 -0
- package/dist/plan/merge-order.d.ts +8 -0
- package/dist/plan/merge-order.d.ts.map +1 -0
- package/dist/plan/merge-order.js +32 -0
- package/dist/plan/merge-order.js.map +1 -0
- package/dist/plan/plan-problems.d.ts +8 -0
- package/dist/plan/plan-problems.d.ts.map +1 -0
- package/dist/plan/plan-problems.js +57 -0
- package/dist/plan/plan-problems.js.map +1 -0
- package/dist/plan/plan-waves.d.ts +16 -0
- package/dist/plan/plan-waves.d.ts.map +1 -0
- package/dist/plan/plan-waves.js +23 -0
- package/dist/plan/plan-waves.js.map +1 -0
- package/dist/plan/rows-to-plan.d.ts +7 -0
- package/dist/plan/rows-to-plan.d.ts.map +1 -0
- package/dist/plan/rows-to-plan.js +19 -0
- package/dist/plan/rows-to-plan.js.map +1 -0
- package/dist/plan/wave-numbers.d.ts +8 -0
- package/dist/plan/wave-numbers.d.ts.map +1 -0
- package/dist/plan/wave-numbers.js +27 -0
- package/dist/plan/wave-numbers.js.map +1 -0
- package/dist/plan/wave-plan.d.ts +48 -0
- package/dist/plan/wave-plan.d.ts.map +1 -0
- package/dist/plan/wave-plan.js +2 -0
- package/dist/plan/wave-plan.js.map +1 -0
- package/dist/progress/format-progress.d.ts.map +1 -1
- package/dist/progress/format-progress.js +16 -1
- package/dist/progress/format-progress.js.map +1 -1
- package/dist/progress/progress.d.ts +11 -1
- package/dist/progress/progress.d.ts.map +1 -1
- package/dist/progress/read-progress.d.ts +6 -2
- package/dist/progress/read-progress.d.ts.map +1 -1
- package/dist/progress/read-progress.js +10 -5
- package/dist/progress/read-progress.js.map +1 -1
- package/dist/progress/status-row-of.d.ts +16 -0
- package/dist/progress/status-row-of.d.ts.map +1 -0
- package/dist/progress/status-row-of.js +23 -0
- package/dist/progress/status-row-of.js.map +1 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +2 -0
- package/dist/run.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worker/rows-on-branches.d.ts +8 -0
- package/dist/worker/rows-on-branches.d.ts.map +1 -0
- package/dist/worker/rows-on-branches.js +9 -0
- package/dist/worker/rows-on-branches.js.map +1 -0
- package/package.json +2 -2
- package/templates/e2e/e2e.spec.ts.tpl +2 -2
- package/templates/init/e2e/start-application.database.ts.tpl +30 -1
- package/templates/init/e2e/start-application.memory.ts.tpl +30 -1
- package/templates/init/e2e/vitest.e2e.config.ts.tpl +4 -0
- package/templates/init/platform/database/open-test-database.drizzle.ts.tpl +18 -1
- package/templates/init/platform/database/open-test-database.knex.ts.tpl +18 -1
- package/templates/init/platform/database/open-test-database.prisma.ts.tpl +18 -1
- package/templates/init/platform/database/open-test-database.typeorm.ts.tpl +18 -1
- package/templates/init/platform/database/test-database-template.ts.tpl +23 -0
- package/templates/init/rules/tests.md.tpl +1 -1
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/pipeline/vitest.config.ts.tpl +6 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { mkdtemp, rm, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { tmpdir } from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { PGlite } from '@electric-sql/pglite';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The global setup of the test runs (vitest.config.ts, vitest.e2e.config.ts): starts PostgreSQL in
|
|
8
|
+
* process once and saves its initialised cluster to a file. Each spec of the run opens a copy of it
|
|
9
|
+
* (open-test-database.ts) instead of running an initdb of its own, the slow part of starting, then
|
|
10
|
+
* creates its tables there, so that what creates them stays run and measured in every spec. What it
|
|
11
|
+
* resolves is the teardown, which deletes the file.
|
|
12
|
+
*/
|
|
13
|
+
export async function setup(): Promise<() => Promise<void>> {
|
|
14
|
+
const directory = await mkdtemp(path.join(tmpdir(), 'test-database-'));
|
|
15
|
+
const file = path.join(directory, 'cluster.tar');
|
|
16
|
+
const engine = await PGlite.create();
|
|
17
|
+
|
|
18
|
+
await writeFile(file, new Uint8Array(await (await engine.dumpDataDir('none')).arrayBuffer()));
|
|
19
|
+
await engine.close();
|
|
20
|
+
process.env['TEST_DATABASE_TEMPLATE'] = file;
|
|
21
|
+
|
|
22
|
+
return () => rm(directory, { recursive: true, force: true });
|
|
23
|
+
}
|
|
@@ -23,5 +23,5 @@ paths:
|
|
|
23
23
|
- Coverage is a floor per context and layer, read from `coverage` in `ddd-ts-kit.config.json` and held by `npm run verify` (`npm run test:coverage`): a layer under its threshold gets the test that is missing. No `exclude` in the runner config, no `v8 ignore` or `istanbul ignore` comment without `-- ADR-NNNN: <reason>` (`test/coverage-governed`); a rate proves that code ran, never that a test asserts anything.
|
|
24
24
|
- An `it.todo` left by the generator names a behaviour still to prove: replace it by a real test, do not delete it. `npx ddd-ts-kit todo <context>` lists what remains.
|
|
25
25
|
- A test never asserts on a private field; it observes results, recorded events and what the fakes received.
|
|
26
|
-
- `test/e2e/` (project root) drives the whole application through HTTP with generated, seeded data, never reads the database, and asserts the trace of a request with `expectSpanTree(storyOf(trace), [...])`.
|
|
26
|
+
- `test/e2e/` (project root) drives the whole application through HTTP with generated, seeded data, never reads the database, and asserts the trace of a request with `expectSpanTree(storyOf(trace), [...])`. What happens after the answer (the outbox relayed, the handlers it reaches) is asserted once `await application.settled()` has resolved, never after a fixed delay.
|
|
27
27
|
- Write tests with `/ddd-ts-kit:testing`; scaffold with `npx ddd-ts-kit generate builder|e2e`.
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@biomejs/biome": "2.5.15",
|
|
24
24
|
"@commitlint/cli": "^21.2.3",
|
|
25
25
|
"@commitlint/config-conventional": "^21.2.3",
|
|
26
|
-
"@ddd-ts-kit/eslint-plugin": "^0.
|
|
26
|
+
"@ddd-ts-kit/eslint-plugin": "^0.24.0",
|
|
27
27
|
"@eslint/js": "^10.0.1",
|
|
28
28
|
"@typescript/native": "npm:typescript@~7.0.2",
|
|
29
29
|
"@vitest/coverage-v8": "5.0.3",
|
|
@@ -45,7 +45,13 @@ export default defineConfig(({ mode }) => ({
|
|
|
45
45
|
name: INTEGRATION_MODE,
|
|
46
46
|
include: [INTEGRATION_SPECS],
|
|
47
47
|
exclude: NOT_AFFECTED,
|
|
48
|
+
{{#if persistence.hasDatabase}}
|
|
49
|
+
globalSetup: ['test/support/test-database-template.ts'],
|
|
50
|
+
// A hook opens a copy of the PostgreSQL cluster the global setup initialised once per run and creates its tables, or reaches a server: under coverage on a busy machine it can outlast the default 10 seconds.
|
|
51
|
+
{{/if}}
|
|
52
|
+
{{#unless persistence.hasDatabase}}
|
|
48
53
|
// A hook opens the test database (PGlite started and its tables created, or a server reached): under coverage on a busy machine it outlasts the default 10 seconds.
|
|
54
|
+
{{/unless}}
|
|
49
55
|
hookTimeout: 60_000,
|
|
50
56
|
},
|
|
51
57
|
},
|