dsh-plugin-toolkit 0.3.0 → 0.3.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/CHANGELOG.md +5 -0
- package/README.md +10 -0
- package/lib/testkit/mount.mjs +8 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
- `unmount()` now waits one macrotask before the DOM goes away. React schedules work during its own unmount, and closing jsdom first turned that into `ReferenceError: window is not defined` after a passing test. Found by the example plugin's second test.
|
|
6
|
+
- The README links `dsh-plugin-example` and documents that `unmount()` is async.
|
|
7
|
+
|
|
3
8
|
## 0.3.0
|
|
4
9
|
|
|
5
10
|
- `dsh-plugin dev`: copy a rebuilt bundle into the installed plugin, then confirm the reload from the host's `/plugins/events` stream. Subscribing happens *before* the write, because a copy made first is reported to nobody.
|
package/README.md
CHANGED
|
@@ -49,6 +49,8 @@ console.assert(panel.must('[role="status"]').textContent.includes('92'));
|
|
|
49
49
|
await panel.unmount();
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
`unmount()` is async: it lets React finish the work its own unmount schedules before the DOM goes away. Skipping the `await` surfaces as `ReferenceError: window is not defined` *after* the test has already passed, which is a confusing way to learn it.
|
|
53
|
+
|
|
52
54
|
What you get back: `text()`, `html()`, `query(selector)`, `must(selector)` (throws with the rendered HTML when it misses), `click(selector)`, `type(selector, value)`, `press(selector, key)`, `focus`, `attributes(selector)`, `snapshot(dir, name)` for a normalised DOM baseline, and `host` for assertions about what the bundle registered.
|
|
53
55
|
|
|
54
56
|
To look at a bundle by hand:
|
|
@@ -65,6 +67,14 @@ $ npx dsh-plugin mount ../ai-context-doctor/plugin/client.js
|
|
|
65
67
|
AIignore No workspace yet Could not read the report …
|
|
66
68
|
```
|
|
67
69
|
|
|
70
|
+
## Start from the example
|
|
71
|
+
|
|
72
|
+
[`dsh-plugin-example`](https://github.com/WJDdidi-1/dsh-plugin-example) is a ~70-line plugin: one sidebar tab, two languages, one behaviour test, CI that runs `doctor` through the composite action. It is the shape this toolkit expects, so it is also the fastest way to see whether the toolkit fits your plugin.
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
dsh plugin add dsh-plugin-example
|
|
76
|
+
```
|
|
77
|
+
|
|
68
78
|
## Edit a plugin that is already installed
|
|
69
79
|
|
|
70
80
|
The host already swaps a rebuilt bundle without a page reload: it watches each plugin's entry artifact and reports a `rebuilt` frame on `/plugins/events`. `dev` puts the new file where the host is looking, then **proves** the frame arrived instead of asking you to check by eye.
|
package/lib/testkit/mount.mjs
CHANGED
|
@@ -184,7 +184,14 @@ export async function mountClient(options) {
|
|
|
184
184
|
},
|
|
185
185
|
writeSnapshot: (dir, name) => write(dir, name, root.innerHTML),
|
|
186
186
|
unmount: async () => {
|
|
187
|
-
await act(async () =>
|
|
187
|
+
await act(async () => {
|
|
188
|
+
clientRoot.unmount();
|
|
189
|
+
// React schedules follow-up work, and a polling panel schedules timers.
|
|
190
|
+
// One macrotask lets that land while the DOM is still alive; closing the
|
|
191
|
+
// window first turns it into "ReferenceError: window is not defined"
|
|
192
|
+
// after the test has already passed.
|
|
193
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
194
|
+
});
|
|
188
195
|
globalThis.fetch = previousFetch;
|
|
189
196
|
restoreGlobals();
|
|
190
197
|
// A panel polls; jsdom's timers and rAF would keep the test process alive
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-toolkit",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Preflight, release and test DeepSeek Harness plugins: checks what the host needs, waits for npm to actually serve the version, and keeps the market index honest.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|