Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
github
hub
提交
bac731a1
H
hub
项目概览
github
/
hub
10 个月 前同步成功
通知
3
Star
22523
Fork
2406
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hub
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
bac731a1
编写于
10月 29, 2019
作者:
M
Mislav Marohnić
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[docs] Improve CONTRIBUTING documentation
[ci skip]
上级
9238e0b5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
58 addition
and
21 deletion
+58
-21
CONTRIBUTING.md
CONTRIBUTING.md
+9
-21
features/README.md
features/README.md
+49
-0
未找到文件。
CONTRIBUTING.md
浏览文件 @
bac731a1
...
...
@@ -9,11 +9,14 @@ This project adheres to a [Code of Conduct][code-of-conduct]. By participating,
You will need:
1.
Go 1.
9
+
1.
Go 1.
11
+
1.
Ruby 1.9+ with Bundler
2.
git 1.8+
3.
tmux & zsh (optional) - for running shell completion tests
If setting up either Go or Ruby for development proves to be a pain, you can
run the test suite in a prepared Docker container via
`script/docker`
.
## What makes a good hub feature
hub is a tool that wraps git to provide useful integration with GitHub. A new
...
...
@@ -28,7 +31,7 @@ feature is a good idea for hub if it improves some workflow for a GitHub user.
## How to install dependencies and run tests
1.
[
Clone the project
](
./README.md#source
)
into your GOPATH
1.
[
Clone the project
](
./README.md#source
)
2.
Verify that existing tests pass:
`make test-all`
3.
Create a topic branch:
...
...
@@ -49,23 +52,8 @@ dependency.
## How to write tests
The new test suite is written in Cucumber under
`features/`
directory. Each
scenario is actually making real invocations to
`hub`
on the command-line in the
context of a real (dynamically created) git repository.
Whenever a scenario requires talking to the GitHub API, a fake HTTP server is
spun locally to replace the real GitHub API. This is done so that the test suite
runs faster and is available offline as well. The fake API server is defined
as a Sinatra app inline in each scenario:
```
Given the GitHub API server:
"""
post('/repos/github/hub/pulls') {
status 200
}
"""
```
Go unit tests are in
`*_test.go`
files and are runnable with
`make test`
. These
run really fast (under 10s).
The best way to learn to write new tests is to study the existing scenarios for
commands that are similar to those that you want to add or change
.
However, most hub functionality is exercised through integration-style tests
written in Cucumber. See
[
Features
](
./features
)
for more info
.
features/README.md
0 → 100644
浏览文件 @
bac731a1
# Cucumber features for hub
How to run all features:
```
sh
make bin/cucumber
bin/cucumber
```
Because this can take a couple of minutes, you may want to only run select files
related to the functionality that you're developing:
```
sh
bin/cucumber feature/api.feature
```
The Cucumber test suite requires a Ruby development environment. If you want to
avoid setting that up, you can run tests inside a Docker container:
```
sh
script/docker feature/api.feature
```
## How it works
Each scenario is actually making real invocations to
`hub`
on the command-line
in the context of a real (dynamically created) git repository.
Whenever a scenario requires talking to the GitHub API, a fake HTTP server is
spun locally to replace the real GitHub API. This is done so that the test suite
runs faster and is available offline as well. The fake API server is defined
as a Sinatra app inline in each scenario:
```
Given the GitHub API server:
"""
post('/repos/github/hub/pulls') {
status 200
}
"""
```
## How to write new tests
The best way to learn to write new tests is to study the existing scenarios for
commands that are similar to those that you want to add or change.
Since Cucumber tests are written in a natural language, you mostly don't need to
know Ruby to write new tests.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录