@mpcore/vitest 1.0.0 → 1.1.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 CHANGED
@@ -40,3 +40,5 @@ test('renders a page', async ({ mpcore, expect }) => {
40
40
  ```
41
41
 
42
42
  `createMpcoreTest({ artifact: { projectPath: process.cwd() } })` still accepts an existing artifact directly. `createVitestProject()` also uses the configured artifact when omitted, and closes its runtime with the current test. Optional host mocks and `failOnConsoleError` can be passed without replacing the injected artifact. Calling either helper without a configured or explicit artifact reports an actionable error.
43
+
44
+ Setup also registers the semantic tree snapshot serializer from `@mpcore/test`. Use `expect(result.screen).toMatchSnapshot()` or snapshot an individual node. Snapshots preserve public tree and event-binding semantics while removing runtime IDs, style scope markers and generated handler names. Full diagnostic snapshots returned by `page.snapshot()` remain unchanged; use `toMiniProgramSnapshot()` explicitly to serialize one.
package/dist/setup.mjs CHANGED
@@ -1,6 +1,7 @@
1
- import { mpcoreMatchers } from "@mpcore/test";
1
+ import { mpcoreMatchers, mpcoreSnapshotSerializer } from "@mpcore/test";
2
2
  import { expect } from "vitest";
3
3
  //#region src/setup.ts
4
4
  expect.extend(mpcoreMatchers);
5
+ expect.addSnapshotSerializer(mpcoreSnapshotSerializer);
5
6
  //#endregion
6
7
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mpcore/vitest",
3
3
  "type": "module",
4
- "version": "1.0.0",
4
+ "version": "1.1.0",
5
5
  "description": "Vitest integration for @mpcore/test",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -51,10 +51,10 @@
51
51
  "vitest": ">=5.0.0"
52
52
  },
53
53
  "dependencies": {
54
- "@mpcore/test": "1.0.0"
54
+ "@mpcore/test": "1.1.0"
55
55
  },
56
56
  "devDependencies": {
57
- "vitest": "~5.0.3"
57
+ "vitest": "~5.0.5"
58
58
  },
59
59
  "publishConfig": {
60
60
  "access": "public",