# autochecker
autochecker tests your libraries in many different versions of NodeJS, Ruby, Java and many other languages.
Created to make it easier and effortless to make sure your library works in many versions of a language runtime.
Works well with CI as well! ([See some example output](https://github.com/VictorBjelkholm/ruby-autochecker-example/))
(Works out of the box with NodeJS projects right now, more in the future!)
<p align="center">
<img src="./demo.gif" alt="Demonstration of functionality">
</p>
## Requirements
* Docker -> [install here](https://www.docker.com/products/docker-toolbox)
* `package.json` `scripts.test` setup correctly (for NodeJS projects)
* Two environment variables, `DOCKER_HOST` and `DOCKER_CERT_PATH` (comes by default with docker-machine)
`DOCKER_HOST` should look similar to this: `tcp://192.168.99.100:2376`
`DOCKER_CERT_PATH` should look similar to this: `/Users/victor/.docker/machine/machines/default`
## Installation
As always, one step:
* For one project > `npm install autochecker`
* Globally on your computer OR to use with other languages > `npm install -g autochecker`
For extra style points, make sure autochecker is run before publishing your modules:
In `package.json`:
```json
"scripts": {
"prepublish": "autochecker 0.10 0.12 4.0 5.0"
}
```
## Running NodeJS project out of the box
By default, executing `autochecker` will run the tests on all available versions.
You can specify which versions you want to test by adding them in the end of the command:
`autochecker 0.10 0.11 4 5.10.1`
Versions comes from the `mhart/alpine-node` docker image tags
## Running with other languages
To see how you can run autochecker with a Ruby project + CI integration, please take a look at this repository: https://github.com/VictorBjelkholm/ruby-autochecker-example/
Otherwise, there is a couple of examples of other languages in the [/examples](/examples) directory
## Setting max running tests
By default, autochecker starts as many testing sessions as `os.cpu().length` would return.
However, you can overwrite this by providing the TEST_LIMIT environment variable.
Example: `TEST_LIMIT=10 autochecker` to run 10 test sessions at a time
## Custom Dockerfile template
You can specify custom Dockerfile template if you need additional tools installed, for
example if you need `git`, create a file in the project `DockerTemplate` with the following
```
FROM mhart/alpine-node:$VERSION
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json .
# Adding extra tools
RUN apk add --update git
RUN npm install
COPY . .
CMD npm test
```
Variable `$VERSION` will be replaced by autochecker. More information about alpine images
and additional tools at
[docker-alpine](https://github.com/gliderlabs/docker-alpine/blob/master/docs/usage.md) and
[alpine-node](https://github.com/mhart/alpine-node).
Aside from adding libraries to the container, the custom template can be useful to avoid running postinstall
hooks. Just use `RUN npm install --ignore-scripts` instead.
## Programmatic API
You can use `autochecker` in your own projects from NodeJS directly.
```javascript
var autochecker = require('autochecker')
const Docker = require('dockerode')
var dockerode_instance = new Docker({socketPath: '/var/run/docker.sock'});
autochecker.runTestForVersion({
logger: (msg) => { console.log(msg) },
docker: dockerode_instance,
version: '1.1.1', // version of project
name: 'myproject', // name of project
test_cmd: ['npm', 'test'], // command to run tests with
image_name: 'app/image:commit', // What the built application image will be called
path: join(__dirname, 'path_to_project'), // Path to project to build
dockerfile: 'FROM nodejs:$VERSION', // Dockerfile
base_image: 'base/image', // Base image, will add :$VERSION to the end
verbose: false // To show full output or not
})((err, results) => {
console.log(results)
// => {version: '1.1.1', success: true || false, output: 'output from test_cmd'}
})
```
See `cli.js` for usage with testing multiple versions at once.
## Changelog
You can find a list of all versions and changes in the [CHANGELOG.md](CHANGELOG.md) file
## License
MIT License 2016 - Victor Bjelkholm
没有合适的资源?快使用搜索试试~ 我知道了~
️ Test your libraries in many different versions of NodeJS.zip
共56个文件
sh:9个
dockertemplate:7个
md:6个
需积分: 5 0 下载量 72 浏览量
2024-02-04
10:14:42
上传
评论
收藏 1.62MB ZIP 举报
温馨提示
️ Test your libraries in many different versions of NodeJS
资源推荐
资源详情
资源评论
收起资源包目录
️ Test your libraries in many different versions of NodeJS.zip (56个子文件)
ahao11111
.travis.yml 115B
cli.js 8KB
examples
golang
main_test.go 210B
DockerTemplate 93B
autochecker.sh 44B
ruby
.rspec 30B
spec
simple_spec.rb 153B
spec_helper.rb 0B
Gemfile 43B
Gemfile.lock 504B
DockerTemplate 149B
autochecker.sh 87B
clojure
project.clj 276B
doc
intro.md 114B
src
autotest_example
core.clj 103B
LICENSE 11KB
CHANGELOG.md 786B
test
autotest_example
core_test.clj 184B
.gitignore 99B
DockerTemplate 84B
autochecker.sh 46B
README.md 242B
run_all_examples.sh 138B
basic
package.json 280B
autochecker.sh 53B
test.js 65B
java
Calculator.java 197B
CalculatorTest.java 309B
CalculatorTest.class 498B
DockerTemplate 539B
autochecker.sh 66B
Calculator.class 610B
readme.md 742B
dockertemplate
package.json 280B
DockerTemplate 183B
autochecker.sh 53B
test.js 65B
python
main.py 167B
DockerTemplate 100B
autochecker.sh 51B
php
test.php 496B
DockerTemplate 139B
autochecker.sh 92B
CHANGELOG.md 2KB
example_2.gif 36KB
package.json 1KB
index.html 6KB
test
core_test.js 5KB
index.js 6KB
.gitignore 28B
example_4.gif 738KB
example_1.gif 238KB
example_3.gif 87KB
.dockerignore 28B
README.md 4KB
demo.gif 675KB
共 56 条
- 1
资源评论
码农阿豪
- 粉丝: 1w+
- 资源: 1754
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功