Skip to content

Commit a839a70

Browse files
committed
【新增】基于 Mocha、Chromy 的单元测试框架
【优化】基于 ReduceBlank 精简 API 文档代码 【修正】2 处细节问题 【新增】开源志愿者指南、EditorConfig 配置文件
1 parent 1d5e899 commit a839a70

35 files changed

+1410
-4914
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 4
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

Contributing.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# 开源志愿者指南
2+
3+
4+
5+
## 环境依赖
6+
7+
1. [Git](https://git-scm.com/downloads)
8+
9+
2. [Google Chrome](http://www.google.cn/chrome/browser/desktop/) 60+
10+
11+
3. [Node.JS](https://nodejs.org/zh-cn/download/) 7.6+
12+
13+
14+
15+
## 源码构建
16+
17+
UNIX-Shell、Windows-CMD 通用脚本 ——
18+
19+
```Shell
20+
git clone https://gitee.com/Tech_Query/iQuery.git
21+
22+
npm install
23+
24+
npm test
25+
26+
npm run build
27+
```

README.md

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
[![Join the chat at https://gitter.im/iQuery-js/Lobby](https://badges.gitter.im/iQuery-js/Lobby.svg)](https://gitter.im/iQuery-js/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
44

5+
<a target='_blank' rel='nofollow' href='https://app.codesponsor.io/link/terHRJgDULkGjswWhddcBSDJ/TechQuery/iQuery.js'>
6+
<img alt='Sponsor' width='888' height='68' src='https://app.codesponsor.io/embed/terHRJgDULkGjswWhddcBSDJ/TechQuery/iQuery.js.svg' />
7+
</a>
58

69
[**iQuery**](http://tech_query.oschina.io/iquery) 是一个 **普适****轻巧****DOM/JavaScript 开发库** —— **支持 IE 8+ 的 jQuery/W3C 兼容 API**,包含 最常用的 jQuery 静态/实例 属性、方法,适合替代逻辑简单的网页中体积很大的 jQuery,或作为 **Web 前端开发基础库** 嵌入各种 独立发布(不能有外部依赖、自闭合、有兼容性要求)的 JavaScript 库。
710

@@ -157,25 +160,3 @@
157160
- 自带 `DOMParser()` 标准对象构造函数,为 IE 8 提供 **XML 文档解析**支持
158161
- 自带 `URL()` 标准对象构造函数
159162
- 自带 `URLSearchParams()` 标准对象构造函数
160-
161-
162-
163-
## 【参与开发】
164-
165-
### 环境搭建
166-
1. 安装 **Git**(比 SVN 更适合 **开源团队**
167-
2. 安装 **Node.JS** 最新 LTS 版
168-
169-
### 从源码构建
170-
171-
UNIX-Shell、Windows-CMD 通用脚本 ——
172-
173-
```Shell
174-
git clone https://git.oschina.net/Tech_Query/iQuery.git
175-
176-
npm install
177-
178-
npm test
179-
180-
npm run build
181-
```

build/TestKit.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const Path = require('path'),
2+
HTMLPages = require('html-pages'),
3+
Chromy = require('chromy');
4+
5+
const server = HTMLPages('./', {
6+
'log-level': 'warn'
7+
});
8+
9+
async function exit(code) {
10+
11+
await Chromy.cleanup();
12+
13+
server.stop();
14+
15+
process.exit((code != null) ? code : 1);
16+
};
17+
18+
process.on('uncaughtException', exit);
19+
20+
process.on('unhandledRejection', exit);
21+
22+
process.on('SIGINT', exit);
23+
24+
process.on('exit', exit);
25+
26+
27+
exports.exit = exit;
28+
29+
exports.require = new Function(`
30+
31+
return new Promise(function () {
32+
33+
require(['iQuery', '${
34+
Path.relative(
35+
Path.join(process.cwd(), 'test'),
36+
module.parent.filename.slice(0, -3)
37+
).replace(/\\/g, '/')
38+
}'], arguments[0], arguments[1]);
39+
});
40+
`);

build/iQuery.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/iQuery.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)