@ddd-ts-kit/testing 0.1.0 → 0.2.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/dist/coverage/affected-contexts.d.ts +7 -0
- package/dist/coverage/affected-contexts.d.ts.map +1 -0
- package/dist/coverage/affected-contexts.js +15 -0
- package/dist/coverage/affected-contexts.js.map +1 -0
- package/dist/coverage/contexts-in.d.ts +3 -0
- package/dist/coverage/contexts-in.d.ts.map +1 -0
- package/dist/coverage/contexts-in.js +13 -0
- package/dist/coverage/contexts-in.js.map +1 -0
- package/dist/coverage/governed-coverage.d.ts +2 -1
- package/dist/coverage/governed-coverage.d.ts.map +1 -1
- package/dist/coverage/governed-coverage.js +4 -2
- package/dist/coverage/governed-coverage.js.map +1 -1
- package/dist/coverage/governed-jest-coverage.d.ts.map +1 -1
- package/dist/coverage/governed-jest-coverage.js +2 -1
- package/dist/coverage/governed-jest-coverage.js.map +1 -1
- package/dist/coverage/held-layers.d.ts +3 -1
- package/dist/coverage/held-layers.d.ts.map +1 -1
- package/dist/coverage/held-layers.js +9 -12
- package/dist/coverage/held-layers.js.map +1 -1
- package/dist/coverage/measured-files.d.ts +4 -0
- package/dist/coverage/measured-files.d.ts.map +1 -0
- package/dist/coverage/measured-files.js +7 -0
- package/dist/coverage/measured-files.js.map +1 -0
- package/dist/coverage/unaffected-contexts.d.ts +10 -0
- package/dist/coverage/unaffected-contexts.d.ts.map +1 -0
- package/dist/coverage/unaffected-contexts.js +23 -0
- package/dist/coverage/unaffected-contexts.js.map +1 -0
- package/dist/coverage.d.ts +1 -0
- package/dist/coverage.d.ts.map +1 -1
- package/dist/coverage.js +1 -0
- package/dist/coverage.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The contexts a pull request reaches, as `ddd-ts-kit affected` computed them from the context
|
|
3
|
+
* map and the pipeline handed them over; undefined for a run of everything, which is what the
|
|
4
|
+
* default branch gets.
|
|
5
|
+
*/
|
|
6
|
+
export declare function affectedContexts(): readonly string[] | undefined;
|
|
7
|
+
//# sourceMappingURL=affected-contexts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"affected-contexts.d.ts","sourceRoot":"","sources":["../../src/coverage/affected-contexts.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,SAAS,MAAM,EAAE,GAAG,SAAS,CAOhE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Names the bounded contexts a partial run covers, comma separated; unset or empty, the run covers every context. */
|
|
2
|
+
const AFFECTED = 'DDD_TS_KIT_AFFECTED';
|
|
3
|
+
/**
|
|
4
|
+
* The contexts a pull request reaches, as `ddd-ts-kit affected` computed them from the context
|
|
5
|
+
* map and the pipeline handed them over; undefined for a run of everything, which is what the
|
|
6
|
+
* default branch gets.
|
|
7
|
+
*/
|
|
8
|
+
export function affectedContexts() {
|
|
9
|
+
const names = (process.env[AFFECTED] ?? '')
|
|
10
|
+
.split(',')
|
|
11
|
+
.map((name) => name.trim())
|
|
12
|
+
.filter((name) => name !== '');
|
|
13
|
+
return names.length > 0 ? names : undefined;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=affected-contexts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"affected-contexts.js","sourceRoot":"","sources":["../../src/coverage/affected-contexts.ts"],"names":[],"mappings":"AAAA,sHAAsH;AACtH,MAAM,QAAQ,GAAG,qBAAqB,CAAC;AAEvC;;;;GAIG;AACH,MAAM,UAAU,gBAAgB;IAC9B,MAAM,KAAK,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;SACxC,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAC1B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;IAEjC,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contexts-in.d.ts","sourceRoot":"","sources":["../../src/coverage/contexts-in.ts"],"names":[],"mappings":"AAEA,yGAAyG;AACzG,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAUtD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
/** The bounded contexts of a project: the directories directly inside its contexts directory, sorted. */
|
|
3
|
+
export function contextsIn(directory) {
|
|
4
|
+
if (!fs.existsSync(directory)) {
|
|
5
|
+
return [];
|
|
6
|
+
}
|
|
7
|
+
return fs
|
|
8
|
+
.readdirSync(directory, { withFileTypes: true })
|
|
9
|
+
.filter((entry) => entry.isDirectory())
|
|
10
|
+
.map((entry) => entry.name)
|
|
11
|
+
.sort();
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=contexts-in.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contexts-in.js","sourceRoot":"","sources":["../../src/coverage/contexts-in.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,yGAAyG;AACzG,MAAM,UAAU,UAAU,CAAC,SAAiB;IAC1C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,EAAE;SACN,WAAW,CAAC,SAAS,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;SAC/C,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;SACtC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;SAC1B,IAAI,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -10,7 +10,8 @@ export interface GovernedCoverage {
|
|
|
10
10
|
* What a Vitest run measures and the floor it is held to, read from the `coverage` key of
|
|
11
11
|
* `ddd-ts-kit.config.json` (the reference when the key is absent): the one place a threshold is
|
|
12
12
|
* written. `mode` is the mode of the run: `unit` measures domain, application and presentation,
|
|
13
|
-
* `integration` measures infrastructure, any other mode measures the four layers.
|
|
13
|
+
* `integration` measures infrastructure, any other mode measures the four layers. A partial run
|
|
14
|
+
* (`DDD_TS_KIT_AFFECTED`) measures and holds the contexts it names, and no other.
|
|
14
15
|
*
|
|
15
16
|
* // vitest.config.ts
|
|
16
17
|
* import { governedCoverage } from '@ddd-ts-kit/testing/coverage';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"governed-coverage.d.ts","sourceRoot":"","sources":["../../src/coverage/governed-coverage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"governed-coverage.d.ts","sourceRoot":"","sources":["../../src/coverage/governed-coverage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAMzD,8FAA8F;AAC9F,MAAM,WAAW,gBAAgB;IAC/B,8EAA8E;IAC9E,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAC3B,sGAAsG;IACtG,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CACpD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAsB,GAAG,gBAAgB,CAW7F"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { measuredFiles } from './measured-files.js';
|
|
1
2
|
import { governedSettings } from './governed-settings.js';
|
|
2
3
|
import { heldLayers } from './held-layers.js';
|
|
3
4
|
import { measuredLayers } from './measured-layers.js';
|
|
@@ -5,7 +6,8 @@ import { measuredLayers } from './measured-layers.js';
|
|
|
5
6
|
* What a Vitest run measures and the floor it is held to, read from the `coverage` key of
|
|
6
7
|
* `ddd-ts-kit.config.json` (the reference when the key is absent): the one place a threshold is
|
|
7
8
|
* written. `mode` is the mode of the run: `unit` measures domain, application and presentation,
|
|
8
|
-
* `integration` measures infrastructure, any other mode measures the four layers.
|
|
9
|
+
* `integration` measures infrastructure, any other mode measures the four layers. A partial run
|
|
10
|
+
* (`DDD_TS_KIT_AFFECTED`) measures and holds the contexts it names, and no other.
|
|
9
11
|
*
|
|
10
12
|
* // vitest.config.ts
|
|
11
13
|
* import { governedCoverage } from '@ddd-ts-kit/testing/coverage';
|
|
@@ -18,7 +20,7 @@ export function governedCoverage(mode, root = process.cwd()) {
|
|
|
18
20
|
const layers = measuredLayers(mode);
|
|
19
21
|
const held = heldLayers(root, contextsDir, layers);
|
|
20
22
|
return {
|
|
21
|
-
include:
|
|
23
|
+
include: measuredFiles(contextsDir, layers),
|
|
22
24
|
thresholds: Object.fromEntries(held.map(({ layer, directory }) => [`${directory}/**/*.ts`, { ...thresholds[layer] }])),
|
|
23
25
|
};
|
|
24
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"governed-coverage.js","sourceRoot":"","sources":["../../src/coverage/governed-coverage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAUtD
|
|
1
|
+
{"version":3,"file":"governed-coverage.js","sourceRoot":"","sources":["../../src/coverage/governed-coverage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAUtD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,IAAI,GAAW,OAAO,CAAC,GAAG,EAAE;IACzE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACpC,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IAEnD,OAAO;QACL,OAAO,EAAE,aAAa,CAAC,WAAW,EAAE,MAAM,CAAC;QAC3C,UAAU,EAAE,MAAM,CAAC,WAAW,CAC5B,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,SAAS,UAAU,EAAE,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CACvF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"governed-jest-coverage.d.ts","sourceRoot":"","sources":["../../src/coverage/governed-jest-coverage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"governed-jest-coverage.d.ts","sourceRoot":"","sources":["../../src/coverage/governed-jest-coverage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAMzD,2EAA2E;AAC3E,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,EAAE,CAAC;IACvC,2GAA2G;IAC3G,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CAC3D;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,GAAE,MAAsB,GAAG,oBAAoB,CAWvF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { governedSettings } from './governed-settings.js';
|
|
2
2
|
import { heldLayers } from './held-layers.js';
|
|
3
|
+
import { measuredFiles } from './measured-files.js';
|
|
3
4
|
import { measuredLayers } from './measured-layers.js';
|
|
4
5
|
/**
|
|
5
6
|
* The same as `governedCoverage`, in the options of Jest, which runs every spec in one run: the
|
|
@@ -15,7 +16,7 @@ export function governedJestCoverage(root = process.cwd()) {
|
|
|
15
16
|
const layers = measuredLayers('all');
|
|
16
17
|
const held = heldLayers(root, contextsDir, layers);
|
|
17
18
|
return {
|
|
18
|
-
collectCoverageFrom: layers.map((
|
|
19
|
+
collectCoverageFrom: measuredFiles(contextsDir, layers).map((files) => `<rootDir>/${files}`),
|
|
19
20
|
coverageThreshold: Object.fromEntries(held.map(({ layer, directory }) => [`./${directory}/`, { ...thresholds[layer] }])),
|
|
20
21
|
};
|
|
21
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"governed-jest-coverage.js","sourceRoot":"","sources":["../../src/coverage/governed-jest-coverage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAStD;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAI,GAAW,OAAO,CAAC,GAAG,EAAE;IAC/D,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IACrC,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IAEnD,OAAO;QACL,mBAAmB,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"governed-jest-coverage.js","sourceRoot":"","sources":["../../src/coverage/governed-jest-coverage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAStD;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAI,GAAW,OAAO,CAAC,GAAG,EAAE;IAC/D,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IACrC,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IAEnD,OAAO;QACL,mBAAmB,EAAE,aAAa,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,KAAK,EAAE,CAAC;QAC5F,iBAAiB,EAAE,MAAM,CAAC,WAAW,CACnC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,GAAG,EAAE,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAClF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -9,7 +9,9 @@ export interface HeldLayer {
|
|
|
9
9
|
/**
|
|
10
10
|
* The layers a threshold applies to, among `layers`: one per context that has a source file in
|
|
11
11
|
* it. An empty layer (a context with no route yet, a project just initialised) is held to nothing,
|
|
12
|
-
* and is held to its threshold from its first source file.
|
|
12
|
+
* and is held to its threshold from its first source file. A partial run (`DDD_TS_KIT_AFFECTED`)
|
|
13
|
+
* holds the contexts it names, each to its whole threshold, since it runs every spec of each;
|
|
14
|
+
* the others are measured by the run of everything.
|
|
13
15
|
*/
|
|
14
16
|
export declare function heldLayers(root: string, contextsDir: string, layers: readonly CoverageLayer[]): HeldLayer[];
|
|
15
17
|
//# sourceMappingURL=held-layers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"held-layers.d.ts","sourceRoot":"","sources":["../../src/coverage/held-layers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"held-layers.d.ts","sourceRoot":"","sources":["../../src/coverage/held-layers.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKzD,sGAAsG;AACtG,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,sEAAsE;IACtE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,aAAa,EAAE,GAAG,SAAS,EAAE,CAU3G"}
|
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
+
import { affectedContexts } from './affected-contexts.js';
|
|
4
|
+
import { contextsIn } from './contexts-in.js';
|
|
3
5
|
const SOURCE = /(?<!\.d)\.[cm]?ts$/;
|
|
4
6
|
const SPEC = /\.(?:spec|test)\.[cm]?ts$/;
|
|
5
7
|
/**
|
|
6
8
|
* The layers a threshold applies to, among `layers`: one per context that has a source file in
|
|
7
9
|
* it. An empty layer (a context with no route yet, a project just initialised) is held to nothing,
|
|
8
|
-
* and is held to its threshold from its first source file.
|
|
10
|
+
* and is held to its threshold from its first source file. A partial run (`DDD_TS_KIT_AFFECTED`)
|
|
11
|
+
* holds the contexts it names, each to its whole threshold, since it runs every spec of each;
|
|
12
|
+
* the others are measured by the run of everything.
|
|
9
13
|
*/
|
|
10
14
|
export function heldLayers(root, contextsDir, layers) {
|
|
11
|
-
|
|
15
|
+
const affected = affectedContexts();
|
|
16
|
+
return contextsIn(path.join(root, contextsDir))
|
|
17
|
+
.filter((context) => affected === undefined || affected.includes(context))
|
|
18
|
+
.flatMap((context) => layers
|
|
12
19
|
.map((layer) => ({ context, layer, directory: `${contextsDir}/${context}/${layer}` }))
|
|
13
20
|
.filter(({ directory }) => holdsASource(path.join(root, directory))));
|
|
14
21
|
}
|
|
15
|
-
function contextsIn(directory) {
|
|
16
|
-
if (!fs.existsSync(directory)) {
|
|
17
|
-
return [];
|
|
18
|
-
}
|
|
19
|
-
return fs
|
|
20
|
-
.readdirSync(directory, { withFileTypes: true })
|
|
21
|
-
.filter((entry) => entry.isDirectory())
|
|
22
|
-
.map((entry) => entry.name)
|
|
23
|
-
.sort();
|
|
24
|
-
}
|
|
25
22
|
function holdsASource(directory) {
|
|
26
23
|
if (!fs.existsSync(directory)) {
|
|
27
24
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"held-layers.js","sourceRoot":"","sources":["../../src/coverage/held-layers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"held-layers.js","sourceRoot":"","sources":["../../src/coverage/held-layers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,MAAM,MAAM,GAAG,oBAAoB,CAAC;AACpC,MAAM,IAAI,GAAG,2BAA2B,CAAC;AAUzC;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,WAAmB,EAAE,MAAgC;IAC5F,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;IAEpC,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;SAC5C,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;SACzE,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CACnB,MAAM;SACH,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,WAAW,IAAI,OAAO,IAAI,KAAK,EAAE,EAAE,CAAC,CAAC;SACrF,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CACvE,CAAC;AACN,CAAC;AAED,SAAS,YAAY,CAAC,SAAiB;IACrC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,EAAE;SACN,WAAW,CAAC,SAAS,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;SAChE,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1F,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CoverageLayer } from './coverage-layer.js';
|
|
2
|
+
/** The files a run measures: the given layers of every context, or of the contexts a partial run names; the files no spec loads are included. */
|
|
3
|
+
export declare function measuredFiles(contextsDir: string, layers: readonly CoverageLayer[]): string[];
|
|
4
|
+
//# sourceMappingURL=measured-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measured-files.d.ts","sourceRoot":"","sources":["../../src/coverage/measured-files.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,iJAAiJ;AACjJ,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,aAAa,EAAE,GAAG,MAAM,EAAE,CAI7F"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { affectedContexts } from './affected-contexts.js';
|
|
2
|
+
/** The files a run measures: the given layers of every context, or of the contexts a partial run names; the files no spec loads are included. */
|
|
3
|
+
export function measuredFiles(contextsDir, layers) {
|
|
4
|
+
const contexts = affectedContexts() ?? ['*'];
|
|
5
|
+
return contexts.flatMap((context) => layers.map((layer) => `${contextsDir}/${context}/${layer}/**/*.ts`));
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=measured-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measured-files.js","sourceRoot":"","sources":["../../src/coverage/measured-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,iJAAiJ;AACjJ,MAAM,UAAU,aAAa,CAAC,WAAmB,EAAE,MAAgC;IACjF,MAAM,QAAQ,GAAG,gBAAgB,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IAE7C,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,WAAW,IAAI,OAAO,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC;AAC5G,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The directories of the contexts a partial run leaves out, from the root of the project and
|
|
3
|
+
* ending in `/`: every context that `DDD_TS_KIT_AFFECTED` does not name. Empty for a run of
|
|
4
|
+
* everything. The runner config excludes their specs; what lives outside the contexts always runs.
|
|
5
|
+
*
|
|
6
|
+
* // vitest.config.ts
|
|
7
|
+
* const NOT_AFFECTED = unaffectedContexts().map((directory) => `${directory}**`);
|
|
8
|
+
*/
|
|
9
|
+
export declare function unaffectedContexts(root?: string): string[];
|
|
10
|
+
//# sourceMappingURL=unaffected-contexts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unaffected-contexts.d.ts","sourceRoot":"","sources":["../../src/coverage/unaffected-contexts.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,GAAE,MAAsB,GAAG,MAAM,EAAE,CAYzE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { affectedContexts } from './affected-contexts.js';
|
|
3
|
+
import { contextsIn } from './contexts-in.js';
|
|
4
|
+
import { governedSettings } from './governed-settings.js';
|
|
5
|
+
/**
|
|
6
|
+
* The directories of the contexts a partial run leaves out, from the root of the project and
|
|
7
|
+
* ending in `/`: every context that `DDD_TS_KIT_AFFECTED` does not name. Empty for a run of
|
|
8
|
+
* everything. The runner config excludes their specs; what lives outside the contexts always runs.
|
|
9
|
+
*
|
|
10
|
+
* // vitest.config.ts
|
|
11
|
+
* const NOT_AFFECTED = unaffectedContexts().map((directory) => `${directory}**`);
|
|
12
|
+
*/
|
|
13
|
+
export function unaffectedContexts(root = process.cwd()) {
|
|
14
|
+
const affected = affectedContexts();
|
|
15
|
+
if (affected === undefined) {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
const { contextsDir } = governedSettings(root);
|
|
19
|
+
return contextsIn(path.join(root, contextsDir))
|
|
20
|
+
.filter((context) => !affected.includes(context))
|
|
21
|
+
.map((context) => `${contextsDir}/${context}/`);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=unaffected-contexts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unaffected-contexts.js","sourceRoot":"","sources":["../../src/coverage/unaffected-contexts.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAI,GAAW,OAAO,CAAC,GAAG,EAAE;IAC7D,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;IAEpC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,EAAE,WAAW,EAAE,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAE/C,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;SAC5C,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;SAChD,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,WAAW,IAAI,OAAO,GAAG,CAAC,CAAC;AACpD,CAAC"}
|
package/dist/coverage.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ export type { CoverageRates } from './coverage/coverage-rates.js';
|
|
|
3
3
|
export { governedCoverage, type GovernedCoverage } from './coverage/governed-coverage.js';
|
|
4
4
|
export { governedJestCoverage, type GovernedJestCoverage } from './coverage/governed-jest-coverage.js';
|
|
5
5
|
export { REFERENCE_COVERAGE } from './coverage/reference-coverage.js';
|
|
6
|
+
export { unaffectedContexts } from './coverage/unaffected-contexts.js';
|
|
6
7
|
//# sourceMappingURL=coverage.d.ts.map
|
package/dist/coverage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../src/coverage.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,YAAY,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,KAAK,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACvG,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC"}
|
|
1
|
+
{"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../src/coverage.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,YAAY,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,KAAK,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACvG,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC"}
|
package/dist/coverage.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { governedCoverage } from './coverage/governed-coverage.js';
|
|
2
2
|
export { governedJestCoverage } from './coverage/governed-jest-coverage.js';
|
|
3
3
|
export { REFERENCE_COVERAGE } from './coverage/reference-coverage.js';
|
|
4
|
+
export { unaffectedContexts } from './coverage/unaffected-contexts.js';
|
|
4
5
|
//# sourceMappingURL=coverage.js.map
|
package/dist/coverage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coverage.js","sourceRoot":"","sources":["../src/coverage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAyB,MAAM,iCAAiC,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAA6B,MAAM,sCAAsC,CAAC;AACvG,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC"}
|
|
1
|
+
{"version":3,"file":"coverage.js","sourceRoot":"","sources":["../src/coverage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAyB,MAAM,iCAAiC,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAA6B,MAAM,sCAAsC,CAAC;AACvG,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ddd-ts-kit/testing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Readable tests without mocks: test data builders, given/when/then scenarios and contract suites shared by fakes and real adapters.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"dist"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@ddd-ts-kit/kernel": "0.
|
|
49
|
+
"@ddd-ts-kit/kernel": "0.2.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@ddd-ts-kit/aspects": "0.
|
|
53
|
-
"@ddd-ts-kit/events": "0.
|
|
52
|
+
"@ddd-ts-kit/aspects": "0.2.0",
|
|
53
|
+
"@ddd-ts-kit/events": "0.2.0",
|
|
54
54
|
"@faker-js/faker": "^10.6.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|