@mpcore/test 0.1.8 → 0.1.9

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.
Files changed (2) hide show
  1. package/dist/index.mjs +7 -3
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -303,9 +303,13 @@ var MiniProgramUser = class {
303
303
  this.settle = settle;
304
304
  }
305
305
  async nodeHandle(node) {
306
- const handle = await this.page.$(`[data-sim-node="${node.nodeId}"]`);
307
- if (!handle) throw new Error("The mini-program node is no longer available for interaction.");
308
- return handle;
306
+ const scopes = [this.page];
307
+ for (const scope of scopes) {
308
+ const handle = await scope.$(`[data-sim-node="${node.nodeId}"]`);
309
+ if (handle) return handle;
310
+ scopes.push(...await scope.$$("component"));
311
+ }
312
+ throw new Error("The mini-program node is no longer available for interaction.");
309
313
  }
310
314
  async finish() {
311
315
  await this.settle();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mpcore/test",
3
3
  "type": "module",
4
- "version": "0.1.8",
4
+ "version": "0.1.9",
5
5
  "description": "Testing Library-style utilities for compiled WeChat mini-program artifacts",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -38,7 +38,7 @@
38
38
  "node": "^20.19.0 || >=22.12.0"
39
39
  },
40
40
  "dependencies": {
41
- "@mpcore/simulator": "0.4.3"
41
+ "@mpcore/simulator": "0.5.0"
42
42
  },
43
43
  "publishConfig": {
44
44
  "access": "public",
@@ -49,7 +49,7 @@
49
49
  "build": "tsdown",
50
50
  "test": "vitest run",
51
51
  "test:dev": "vitest",
52
- "test:types": "pnpm build && tsd",
52
+ "test:types": "pnpm build && tsd --files \"test-d/**/*.test-d.ts\"",
53
53
  "typecheck": "tsc --noEmit"
54
54
  }
55
55
  }