Skip to content

Commit 2c68a75

Browse files
committed
initial commit
0 parents  commit 2c68a75

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+16273
-0
lines changed

.github/workflows/ci.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
pull_request:
9+
branches:
10+
- main
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: pnpm/action-setup@v4
18+
with:
19+
run_install: false
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: lts/*
23+
cache: pnpm
24+
25+
- run: pnpm i -g @antfu/ni
26+
- run: nci
27+
- run: nr lint
28+
- run: nr typecheck
29+
30+
test:
31+
runs-on: ${{ matrix.os }}
32+
33+
strategy:
34+
matrix:
35+
node: [lts/*]
36+
os: [ubuntu-latest, windows-latest, macos-latest]
37+
fail-fast: false
38+
39+
steps:
40+
- uses: actions/checkout@v4
41+
- uses: pnpm/action-setup@v4
42+
with:
43+
run_install: false
44+
- name: Set node ${{ matrix.node }}
45+
uses: actions/setup-node@v4
46+
with:
47+
node-version: ${{ matrix.node }}
48+
cache: pnpm
49+
50+
- run: pnpm i -g @antfu/ni
51+
- run: nci
52+
- run: nr build
53+
- run: nr test

.github/workflows/release.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
uses: sxzz/workflows/.github/workflows/release.yml@v1
11+
with:
12+
publish: true
13+
permissions:
14+
contents: write
15+
id-token: write

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.cache
2+
.DS_Store
3+
.idea
4+
*.log
5+
*.tgz
6+
coverage
7+
dist
8+
lib-cov
9+
logs
10+
node_modules
11+
temp

.vscode/extensions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"dbaeumer.vscode-eslint"
4+
]
5+
}

.vscode/settings.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
// Disable the default formatter, use eslint instead
3+
"prettier.enable": false,
4+
"editor.formatOnSave": false,
5+
6+
// Auto fix
7+
"editor.codeActionsOnSave": {
8+
"source.fixAll.eslint": "explicit",
9+
"source.organizeImports": "never"
10+
},
11+
12+
// Enable eslint for all supported languages
13+
"eslint.validate": [
14+
"javascript",
15+
"javascriptreact",
16+
"typescript",
17+
"typescriptreact",
18+
"vue",
19+
"html",
20+
"markdown",
21+
"json",
22+
"jsonc",
23+
"yaml"
24+
],
25+
"cSpell.words": [
26+
"automator"
27+
]
28+
}

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025-PRESENT FliPPeDround <https://github.com/flippedround>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<a href="https://uni-helper.js.org/vitest-environment-uniapp"><img src="./banner.svg" alt="banner" width="100%"/></a>
2+
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>
6+
<br/>
7+
8+
# [uni-helper](https://uni-helper.js.org) 封装的uni命令
9+
10+
## 安装
11+
12+
```bash
13+
pnpm i -D vitest-environment-uniapp
14+
```
15+
16+
## 使用
17+
18+
19+
```bash
20+
pnpm test
21+
```
22+
23+
```json
24+
// package.json
25+
{
26+
"scripts": {
27+
"test": "vitest",
28+
}
29+
}
30+
```
31+
32+
```ts
33+
// unh.config.ts
34+
import { defineConfig } from 'vitest/config'
35+
36+
export default defineConfig({
37+
test: {
38+
environment: 'uniapp',
39+
environmentOptions: {
40+
compile: true,
41+
platform: 'h5', // 测试平台
42+
projectPath: './src', // manifest.json 所在目录
43+
port: 5121,
44+
h5: {
45+
url: 'http://localhost:5180/', // 改成你的 H5 服务器地址
46+
options: {
47+
headless: false, // 是否无头模式
48+
},
49+
},
50+
},
51+
},
52+
})
53+
54+
```

0 commit comments

Comments
 (0)