@dads-framework/testing 0.6.0 → 0.6.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/README.md +72 -20
- package/dist/commands/diagnose.d.ts +4 -0
- package/dist/commands/diagnose.d.ts.map +1 -1
- package/dist/commands/diagnose.js +50 -10
- package/dist/commands/diagnose.js.map +1 -1
- package/dist/dad-test-cli.d.ts.map +1 -1
- package/dist/dad-test-cli.js +18 -3
- package/dist/dad-test-cli.js.map +1 -1
- package/dist/init/infer-one-package.d.ts.map +1 -1
- package/dist/init/infer-one-package.js +5 -4
- package/dist/init/infer-one-package.js.map +1 -1
- package/dist/init/init-testing-manifest.js +1 -1
- package/dist/init/init-testing-manifest.js.map +1 -1
- package/dist/nx/dads-identifier.d.ts +7 -3
- package/dist/nx/dads-identifier.d.ts.map +1 -1
- package/dist/nx/dads-identifier.js +23 -5
- package/dist/nx/dads-identifier.js.map +1 -1
- package/dist/nx/index.d.ts +5 -1
- package/dist/nx/index.d.ts.map +1 -1
- package/dist/nx/index.js +5 -1
- package/dist/nx/index.js.map +1 -1
- package/dist/nx/nx-eject-targets.d.ts +30 -0
- package/dist/nx/nx-eject-targets.d.ts.map +1 -0
- package/dist/nx/nx-eject-targets.js +283 -0
- package/dist/nx/nx-eject-targets.js.map +1 -0
- package/dist/nx/nx-eject-vitest.d.ts +24 -0
- package/dist/nx/nx-eject-vitest.d.ts.map +1 -0
- package/dist/nx/nx-eject-vitest.js +156 -0
- package/dist/nx/nx-eject-vitest.js.map +1 -0
- package/dist/nx/nx-eject-workspace.d.ts +45 -0
- package/dist/nx/nx-eject-workspace.d.ts.map +1 -0
- package/dist/nx/nx-eject-workspace.js +267 -0
- package/dist/nx/nx-eject-workspace.js.map +1 -0
- package/dist/nx/nx-native-cli.js +88 -8
- package/dist/nx/nx-native-cli.js.map +1 -1
- package/dist/nx/nx-native-inputs.d.ts +9 -2
- package/dist/nx/nx-native-inputs.d.ts.map +1 -1
- package/dist/nx/nx-native-inputs.js +87 -35
- package/dist/nx/nx-native-inputs.js.map +1 -1
- package/dist/nx/nx-native-model.d.ts +3 -2
- package/dist/nx/nx-native-model.d.ts.map +1 -1
- package/dist/nx/nx-native-model.js +117 -28
- package/dist/nx/nx-native-model.js.map +1 -1
- package/dist/nx/nx-native-scope.d.ts +1 -1
- package/dist/nx/nx-native-scope.d.ts.map +1 -1
- package/dist/nx/nx-native-workspace.d.ts +14 -1
- package/dist/nx/nx-native-workspace.d.ts.map +1 -1
- package/dist/nx/nx-native-workspace.js +40 -5
- package/dist/nx/nx-native-workspace.js.map +1 -1
- package/dist/testing.tsbuildinfo +1 -1
- package/nx/README.md +78 -39
- package/package.json +6 -6
package/nx/README.md
CHANGED
|
@@ -65,27 +65,45 @@ adapter follows dependencies and expands inputs.
|
|
|
65
65
|
|
|
66
66
|
## Commands
|
|
67
67
|
|
|
68
|
-
### `dad-test-nx plan|run [workspace]`
|
|
68
|
+
### `dad-test-nx plan|run|diagnose|eject [workspace]`
|
|
69
69
|
|
|
70
70
|
`plan` discovers the current Nx project graph and plans verification without
|
|
71
|
-
executing targets
|
|
71
|
+
executing targets, using Oxc symbol-level reachability for `test`, `typecheck`,
|
|
72
|
+
and `build` targets. `run` plans the same way, then delegates the selected
|
|
72
73
|
targets to the installed Nx CLI, preserving configurations, inferred
|
|
73
|
-
executors, command options, environment settings, and prerequisites.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
executors, command options, environment settings, and prerequisites. `diagnose`
|
|
75
|
+
runs the coupling and precision X-ray directly against the live Nx graph with
|
|
76
|
+
zero hand-authored manifest (`dad-test diagnose` also auto-detects `nx.json`
|
|
77
|
+
and invokes this path automatically). `eject` is the one-command exit ramp off
|
|
78
|
+
Nx: it reads the live Nx project graph (including plugin-inferred Vitest,
|
|
79
|
+
ESLint, TypeScript, and `nx:run-commands` targets) and generates a standalone,
|
|
80
|
+
zero-Nx `dads.testing.json` with Vitest `fileNarrowing`, pure-check `dependsOn`
|
|
81
|
+
wiring, optional `nxViteTsPaths()` → `dadsTsconfigPaths()` config rewriting,
|
|
82
|
+
and an uninstall checklist. The workspace defaults to the current directory.
|
|
83
|
+
Options:
|
|
84
|
+
|
|
85
|
+
- `--base <ref>` compares that ref with the working tree (`plan`, `run`).
|
|
77
86
|
- `--head <ref>` narrows the comparison to two commits; it requires `--base`,
|
|
78
|
-
and that revision must be the clean checked-out `HEAD
|
|
87
|
+
and that revision must be the clean checked-out `HEAD` (`plan`, `run`).
|
|
79
88
|
- `--all` selects the complete fallback. It cannot be combined with `--base`
|
|
80
|
-
or `--head
|
|
89
|
+
or `--head` (`plan`, `run`).
|
|
81
90
|
- `--targets <a,b>` selects exact Nx target names instead of the default
|
|
82
91
|
verification families. Each name must be non-empty.
|
|
83
|
-
- `--jobs <n>` sets the worker limit; it must be a positive integer.
|
|
84
|
-
- `--
|
|
85
|
-
|
|
92
|
+
- `--jobs <n>` sets the worker limit; it must be a positive integer (`run`).
|
|
93
|
+
- `--write` writes `dads.testing.json` and `dads.testing.eject-report.json`
|
|
94
|
+
(`eject` runs as a dry-run preview without `--write`).
|
|
95
|
+
- `--force` allows overwriting an existing `dads.testing.json` (`eject --write`).
|
|
96
|
+
- `--replace-nx-vite-paths` rewrites clean `nxViteTsPaths()` imports and calls
|
|
97
|
+
to `dadsTsconfigPaths()` from `@dads-framework/testing/vitest` (`eject --write`).
|
|
98
|
+
- `--json` prints the whole result object with readable project and task ids
|
|
99
|
+
(such as `api:test`, escaping only names that contain non-identifier
|
|
100
|
+
characters). The human summary lines are not a contract.
|
|
101
|
+
- `-h`, `--help` prints full command usage and exits `0`.
|
|
86
102
|
|
|
87
103
|
Each call rebuilds the declared task inventory, so there is no frozen manifest
|
|
88
|
-
to silently omit a newly inferred task.
|
|
104
|
+
to silently omit a newly inferred task. When `.nx/` is gitignored, `nx graph`
|
|
105
|
+
reuses the workspace's existing `.nx/workspace-data` cache instead of forcing a
|
|
106
|
+
cold plugin scan.
|
|
89
107
|
|
|
90
108
|
The default inventory is the exact targets `test`, `typecheck`, `lint`, and
|
|
91
109
|
`build`, plus any target starting with `test:`, `typecheck:`, `typecheck-`,
|
|
@@ -96,23 +114,34 @@ inside a selected target, and Dads counts the selected root invocations.
|
|
|
96
114
|
|
|
97
115
|
#### What a registered task's scope is
|
|
98
116
|
|
|
99
|
-
A plugin-inferred target is scoped, not refused. Each registered task
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
A plugin-inferred target is scoped, not refused. Each registered task combines
|
|
118
|
+
Nx's declared input model with Oxc symbol-level reachability:
|
|
119
|
+
|
|
120
|
+
- **`test`, `typecheck`, and `build` targets** use `impact.mode: "reachability"`
|
|
121
|
+
across their project root and transitive Nx dependency roots (runtime edges
|
|
122
|
+
for `test`, full runtime plus `import type` edges for `typecheck` and
|
|
123
|
+
`build`), while retaining all non-graph paths in `impact.paths` (workspace
|
|
124
|
+
policy files, shared global inputs, and output-producing `dependsOn`
|
|
125
|
+
prerequisites such as `build` or codegen targets). Editing a comment,
|
|
126
|
+
private unused helper, or unimported export skips unaffected downstream
|
|
127
|
+
projects; editing a non-JS file, shared input, policy file, or dynamic
|
|
128
|
+
import widens conservatively.
|
|
129
|
+
- **`lint` and custom targets** stay on `impact.mode: "changed-files"` across
|
|
130
|
+
their project root, transitive dependency roots, workspace policy files, and
|
|
131
|
+
expanded file inputs so comment and formatting edits still run linters.
|
|
132
|
+
- **Pure-check prerequisites** (targets with explicit `outputs: []`, or
|
|
133
|
+
`lint`/`test`/`typecheck` targets with no declared `outputs`, such as a
|
|
134
|
+
repo-wide `workspace-scripts:lint-walls` gate) are registered once and wired
|
|
135
|
+
into `dependsOn` instead of folding their inputs into every consumer. When
|
|
136
|
+
the gate's own inputs change (or it is `always`), the gate runs once while
|
|
137
|
+
unaffected projects stay skipped.
|
|
138
|
+
- **Output-producing prerequisites** (`^build`, codegen targets, or any target
|
|
139
|
+
with declared `outputs`) stay folded into their consumer's `impact.paths` so
|
|
140
|
+
upstream generator or build source changes always invalidate the consumer.
|
|
141
|
+
- Workspace policy files (`nx.json`, `package.json`, lockfiles,
|
|
142
|
+
`pnpm-workspace.yaml`, `tsconfig.json`, `tsconfig.base.json`), target-level
|
|
143
|
+
and `targetDefaults` inputs (with `namedInputs` expanded), and every
|
|
144
|
+
configuration's inputs are always included.
|
|
116
145
|
|
|
117
146
|
Neither the presence of plugins, nor `targetDefaults`, nor `dependsOn`, nor
|
|
118
147
|
configurations is by itself a reason to give up on a scope. External
|
|
@@ -134,8 +163,7 @@ unowned path and the fallback cannot fire; a root-level file is then in scope
|
|
|
134
163
|
only if Nx's own input model names it. That assumption is written into every
|
|
135
164
|
registered task's reason rather than left implied.
|
|
136
165
|
|
|
137
|
-
|
|
138
|
-
Nx remains authoritative for their execution. Its input model is documented in
|
|
166
|
+
Nx remains authoritative for target execution; its input model is documented in
|
|
139
167
|
the [Nx input reference](https://nx.dev/docs/reference/inputs).
|
|
140
168
|
|
|
141
169
|
The working tree may be dirty. Discovery and planning reject concurrent changes
|
|
@@ -171,15 +199,24 @@ import and writes an explicit report rather than guessing edge direction.
|
|
|
171
199
|
|
|
172
200
|
## Use it
|
|
173
201
|
|
|
174
|
-
The `@dads-framework/testing/nx` entry point exports
|
|
175
|
-
|
|
202
|
+
The `@dads-framework/testing/nx` entry point exports the live adapter,
|
|
203
|
+
diagnostic, identifier, and migration functions:
|
|
176
204
|
|
|
177
205
|
- `planNativeNxTesting(options)` and `runNativeNxTesting(options)` back the
|
|
178
206
|
live adapter. Options are the testing operation request minus `manifestPath`
|
|
179
207
|
and `taskIds` — `workspaceRoot`, `base`, `head`, `all`, `jobs`, plus exact
|
|
180
208
|
`targetNames`. An explicit `nativeBinary` is available for local integration
|
|
181
209
|
testing.
|
|
182
|
-
- `
|
|
210
|
+
- `diagnoseNativeNxTesting(options)` runs the coupling and precision X-ray
|
|
211
|
+
directly against the live Nx graph (`workspaceRoot`, optional `targetNames`,
|
|
212
|
+
optional `nativeBinary`).
|
|
213
|
+
- `ejectNativeNxTesting(options)` materializes Vitest, ESLint, TypeScript, and
|
|
214
|
+
`nx:run-commands` targets into a standalone zero-Nx `dads.testing.json`
|
|
215
|
+
(`workspaceRoot`, optional `targetNames`, `write`, `force`,
|
|
216
|
+
`replaceNxViteTsPaths`, `nativeBinary`).
|
|
217
|
+
- `dadsIdentifier(name)` and `decodeDadsIdentifier(id)` convert between Nx
|
|
218
|
+
names and readable, collision-free Dads identifiers.
|
|
219
|
+
- `importNxTestingWorkspace(options)` backs the one-way migration, taking
|
|
183
220
|
`workspaceRoot`, the approved `expectedGitSha`, and an optional `runner`.
|
|
184
221
|
|
|
185
222
|
Installing `@dads-framework/testing` provides both CLI commands. The adapter
|
|
@@ -208,12 +245,14 @@ invokes the Nx installation in the target workspace.
|
|
|
208
245
|
## Contract
|
|
209
246
|
|
|
210
247
|
`planNativeNxTesting` and `runNativeNxTesting` resolve to
|
|
211
|
-
`{ coverage, plan, run? }
|
|
248
|
+
`{ coverage, plan, run? }`; `diagnoseNativeNxTesting` resolves to
|
|
249
|
+
`{ coverage, diagnose }`. `coverage` carries `projects`, `targets`,
|
|
212
250
|
`registered`, `excluded`, `always`, and a `tasks` list; each entry names its
|
|
213
251
|
`project` and `target`, a `classification` of `registered` or `excluded`, a
|
|
214
|
-
`reason`, and for a registered target its `taskId` and an `impactMode`
|
|
215
|
-
`changed-files
|
|
216
|
-
run results. `dad-test-nx` exits
|
|
252
|
+
`reason`, and for a registered target its readable `taskId` and an `impactMode`
|
|
253
|
+
of `reachability`, `changed-files`, or `always`. `plan`, `run`, and `diagnose`
|
|
254
|
+
are the testing facade's plan, run, and diagnosis results. `dad-test-nx` exits
|
|
255
|
+
with the run's exit code, or `0` after `plan`, `diagnose`, or `--help`.
|
|
217
256
|
|
|
218
257
|
`importNxTestingWorkspace` resolves to `{ manifest, report, manifestPath,
|
|
219
258
|
reportPath }`. The manifest is `schemaVersion: 1` with a workspace rooted at
|
|
@@ -235,7 +274,7 @@ Failures are thrown as errors and, at the CLI, written to stderr. Notable ones:
|
|
|
235
274
|
|
|
236
275
|
| Message | When |
|
|
237
276
|
| --------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
|
|
238
|
-
| `Usage: dad-test-nx plan\|run [workspace] …`
|
|
277
|
+
| `Usage: dad-test-nx plan\|run\|diagnose\|eject [workspace] …` | No operation, or more than two positionals |
|
|
239
278
|
| `Usage: dad-test-import-nx <nx-workspace-root> --sha <full-git-sha>` | Wrong argument shape; exits `2` |
|
|
240
279
|
| `--all cannot be combined with --base or --head.` | Conflicting scope options |
|
|
241
280
|
| `--head requires --base.` | `--head` alone |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dads-framework/testing",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22"
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"typecheck": "tsc -b --pretty false"
|
|
47
47
|
},
|
|
48
48
|
"optionalDependencies": {
|
|
49
|
-
"@dads-framework/testing-native-darwin-arm64": "0.6.
|
|
50
|
-
"@dads-framework/testing-native-darwin-x64": "0.6.
|
|
51
|
-
"@dads-framework/testing-native-linux-arm64-gnu": "0.6.
|
|
52
|
-
"@dads-framework/testing-native-linux-x64-gnu": "0.6.
|
|
53
|
-
"@dads-framework/testing-native-win32-x64": "0.6.
|
|
49
|
+
"@dads-framework/testing-native-darwin-arm64": "0.6.1",
|
|
50
|
+
"@dads-framework/testing-native-darwin-x64": "0.6.1",
|
|
51
|
+
"@dads-framework/testing-native-linux-arm64-gnu": "0.6.1",
|
|
52
|
+
"@dads-framework/testing-native-linux-x64-gnu": "0.6.1",
|
|
53
|
+
"@dads-framework/testing-native-win32-x64": "0.6.1"
|
|
54
54
|
},
|
|
55
55
|
"license": "MIT",
|
|
56
56
|
"author": "Bryton Cooper",
|