https://github.com/k8w/kunit
Javascript unit test framework support wechat app. 支持微信小程序的JS单元测试工具
https://github.com/k8w/kunit
Last synced: 6 months ago
JSON representation
Javascript unit test framework support wechat app. 支持微信小程序的JS单元测试工具
- Host: GitHub
- URL: https://github.com/k8w/kunit
- Owner: k8w
- License: apache-2.0
- Created: 2018-07-03T10:27:18.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-06-17T12:43:50.000Z (over 4 years ago)
- Last Synced: 2025-04-13T01:48:58.144Z (6 months ago)
- Language: TypeScript
- Size: 32.2 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
KUnit
---一个可以用于微信小程序和浏览器的单元测试框架
### 例子
```ts
import { test } from '../index';
import { assert } from 'chai';
import KUnit from '../index';test('测试用例1', function () {
assert.equal(1, 1);
})let case2 = test('异步测试用例 2', function () {
test('2-1', async function () {
await (3000);
assert.equal(1, 1);
console.log('FINISH 2-1')
})test('2-2', async function () {
await (500);
assert.equal(1, 2);
console.log('FINISH 2-2')
})
})test('测试用例3', function () {
assert.equal(1, 2, '1等于2应该异常');
})test('同步测试用例 4', function () {
test('2-1', function () {
assert.equal(1, 1);
})test('2-2', function () {
assert.equal(1, 2);
})
})async function wait(ms: number) {
return new Promise(rs => {
setTimeout(() => { rs() }, ms);
})
}KUnit.instance.runAll();
```