vitest-environment-uniapp 0.0.1 → 0.0.2

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
@@ -1,11 +1,16 @@
1
1
  <a href="https://uni-helper.js.org/vitest-environment-uniapp"><img src="./banner.svg" alt="banner" width="100%"/></a>
2
2
 
3
3
  <a href="https://github.com/uni-helper/vitest-environment-uniapp/stargazers"><img src="https://img.shields.io/github/stars/uni-helper/vitest-environment-uniapp?colorA=005947&colorB=eee&style=for-the-badge"></a>
4
- <a href="https://www.npmjs.com/package/flippedround/vitest-environment-uniapp"><img src="https://img.shields.io/npm/dm/flippedround/vitest-environment-uniapp?colorA=005947&colorB=eee&style=for-the-badge"></a>
5
- <a href="https://www.npmjs.com/package/flippedround/vitest-environment-uniapp"><img src="https://img.shields.io/npm/v/flippedround/vitest-environment-uniapp?colorA=005947&colorB=eee&style=for-the-badge"></a>
4
+ <a href="https://www.npmjs.com/package/flippedround/vitest-environment-uniapp"><img src="https://img.shields.io/npm/dm/vitest-environment-uniapp?colorA=005947&colorB=eee&style=for-the-badge"></a>
5
+ <a href="https://www.npmjs.com/package/flippedround/vitest-environment-uniapp"><img src="https://img.shields.io/npm/v/vitest-environment-uniapp?colorA=005947&colorB=eee&style=for-the-badge"></a>
6
6
  <br/>
7
7
 
8
- # [uni-helper](https://uni-helper.js.org) 封装的uni命令
8
+ # Vitest uni-app e2e 测试环境
9
+
10
+ ## 已知问题
11
+
12
+ - h5 平台下,无法获取启动状态导致超时。
13
+ - environmentOptions 参数同 [uni-app 官方文档](https://uniapp.dcloud.net.cn/worktile/auto/quick-start.html#jestconfigjs) , 但官网长久未更新,导致参数与实际不符。
9
14
 
10
15
  ## 安装
11
16
 
@@ -15,22 +20,20 @@ pnpm i -D vitest-environment-uniapp
15
20
 
16
21
  ## 使用
17
22
 
18
-
19
23
  ```bash
20
24
  pnpm test
21
25
  ```
22
-
26
+ > package.json
23
27
  ```json
24
- // package.json
25
28
  {
26
29
  "scripts": {
27
- "test": "vitest",
30
+ "test": "vitest"
28
31
  }
29
32
  }
30
33
  ```
31
34
 
35
+ > vitest.config.ts
32
36
  ```ts
33
- // unh.config.ts
34
37
  import { defineConfig } from 'vitest/config'
35
38
 
36
39
  export default defineConfig({
@@ -50,5 +53,14 @@ export default defineConfig({
50
53
  },
51
54
  },
52
55
  })
53
-
56
+ ```
57
+ > tsconfig.json
58
+ ```json
59
+ {
60
+ "compilerOptions": {
61
+ "types": [
62
+ "vitest-environment-uniapp/types"
63
+ ]
64
+ }
65
+ }
54
66
  ```
package/dist/index.d.mts CHANGED
@@ -6,7 +6,6 @@ import { Environment } from "vitest/environments";
6
6
  interface Global {
7
7
  program: {
8
8
  teardown: () => Promise<void>;
9
- remote: (enable: boolean) => Promise<void>;
10
9
  };
11
10
  uni: unknown;
12
11
  }
package/dist/index.mjs CHANGED
@@ -17,7 +17,7 @@ var UniAppEnvironment = class {
17
17
  ...options,
18
18
  platform
19
19
  });
20
- if (options?.devtools?.remote) await global.program.remote(true);
20
+ if (options?.devtools?.remote) await program.remote(true);
21
21
  const uni = initUni(program);
22
22
  this._store.uni = uni;
23
23
  this._store.program = program;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest-environment-uniapp",
3
3
  "type": "module",
4
- "version": "0.0.1",
4
+ "version": "0.0.2",
5
5
  "description": "Vitest environment for UniApp",
6
6
  "author": "FliPPeDround <flippedround@qq.com>",
7
7
  "license": "MIT",