@dads-framework/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/README.md +68 -7
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -11,17 +11,78 @@ the proof runs out he widens out loud, with a reason and a line number.
|
|
|
11
11
|
|
|
12
12
|
## Try it
|
|
13
13
|
|
|
14
|
-
Use
|
|
15
|
-
release
|
|
14
|
+
Use Node.js 22 or newer and Git. The npm install below is for the public
|
|
15
|
+
release and includes the [matching native runtime](#native-packages). For a
|
|
16
|
+
source checkout, first run the following from its root, then skip the
|
|
17
|
+
`npm install` line in the example.
|
|
16
18
|
|
|
17
19
|
```sh
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
dad-test
|
|
22
|
-
|
|
20
|
+
npm ci
|
|
21
|
+
npm run build
|
|
22
|
+
cargo build -p dad-test
|
|
23
|
+
export DADS_TEST_NATIVE_BINARY="$PWD/target/debug/dad-test"
|
|
24
|
+
export PATH="$PWD/node_modules/.bin:$PATH"
|
|
23
25
|
```
|
|
24
26
|
|
|
27
|
+
Run the example in an empty directory.
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
npm init -y
|
|
31
|
+
npm install --save-dev @dads-framework/testing
|
|
32
|
+
git init -q
|
|
33
|
+
printf 'node_modules/\n' > .gitignore
|
|
34
|
+
mkdir -p api web
|
|
35
|
+
|
|
36
|
+
cat > dads.testing.json <<'JSON'
|
|
37
|
+
{
|
|
38
|
+
"schemaVersion": 1,
|
|
39
|
+
"workspace": { "root": ".", "fullFallback": { "taskIds": ["api:test", "web:test"] } },
|
|
40
|
+
"projects": [
|
|
41
|
+
{ "id": "api", "root": "api", "fallbackDependencies": [] },
|
|
42
|
+
{ "id": "web", "root": "web", "fallbackDependencies": [] }
|
|
43
|
+
],
|
|
44
|
+
"tasks": [
|
|
45
|
+
{
|
|
46
|
+
"id": "api:test",
|
|
47
|
+
"project": "api",
|
|
48
|
+
"kind": "test",
|
|
49
|
+
"execution": { "executable": "node", "args": ["--version"], "cwd": "api" },
|
|
50
|
+
"dependsOn": [],
|
|
51
|
+
"impact": { "mode": "project" }
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"id": "web:test",
|
|
55
|
+
"project": "web",
|
|
56
|
+
"kind": "test",
|
|
57
|
+
"execution": { "executable": "node", "args": ["--version"], "cwd": "web" },
|
|
58
|
+
"dependsOn": [],
|
|
59
|
+
"impact": { "mode": "project" }
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
JSON
|
|
64
|
+
|
|
65
|
+
printf 'export const port = 3000;\n' > api/config.js
|
|
66
|
+
printf 'export const title = "Home";\n' > web/config.js
|
|
67
|
+
git add .
|
|
68
|
+
git -c user.name="Dads Example" -c user.email="example@example.invalid" commit -qm baseline
|
|
69
|
+
|
|
70
|
+
printf 'export const port = 3001;\n' > api/config.js
|
|
71
|
+
PATH="$PWD/node_modules/.bin:$PATH"
|
|
72
|
+
dad-test explain
|
|
73
|
+
result=$(dad-test run --json)
|
|
74
|
+
printf '%s\n' "$result" | node -p 'JSON.parse(require("node:fs").readFileSync(0, "utf8")).result.run.exitCode'
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The explanation reports `RUN api:test` and `SKIP web:test`. The run executes
|
|
78
|
+
the API task's sample command and prints a run exit code of `0`. To generate
|
|
79
|
+
a starting manifest from an existing npm, pnpm, or Yarn workspace, start with
|
|
80
|
+
`dad-test init` and review `dads.testing.init-report.json`.
|
|
81
|
+
|
|
82
|
+
In a checked-in workspace, keep `dads.testing.json` at the workspace root.
|
|
83
|
+
The repository's [testing manifest fixture](../../../fixtures/testing/dads.testing.json)
|
|
84
|
+
does this in `fixtures/testing/` and makes its test task depend on typecheck.
|
|
85
|
+
|
|
25
86
|
## Commands
|
|
26
87
|
|
|
27
88
|
`plan`, `run`, and `explain` share the same selection flags: `--manifest`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dads-framework/testing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22"
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"typecheck": "tsc -b --pretty false"
|
|
27
27
|
},
|
|
28
28
|
"optionalDependencies": {
|
|
29
|
-
"@dads-framework/testing-native-darwin-arm64": "0.
|
|
30
|
-
"@dads-framework/testing-native-darwin-x64": "0.
|
|
31
|
-
"@dads-framework/testing-native-linux-arm64-gnu": "0.
|
|
32
|
-
"@dads-framework/testing-native-linux-x64-gnu": "0.
|
|
33
|
-
"@dads-framework/testing-native-win32-x64": "0.
|
|
29
|
+
"@dads-framework/testing-native-darwin-arm64": "0.2.0",
|
|
30
|
+
"@dads-framework/testing-native-darwin-x64": "0.2.0",
|
|
31
|
+
"@dads-framework/testing-native-linux-arm64-gnu": "0.2.0",
|
|
32
|
+
"@dads-framework/testing-native-linux-x64-gnu": "0.2.0",
|
|
33
|
+
"@dads-framework/testing-native-win32-x64": "0.2.0"
|
|
34
34
|
},
|
|
35
35
|
"license": "MIT",
|
|
36
36
|
"author": "Bryton Cooper",
|