Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ant-tool/atool-test
Test tool based on dora & webpack, run tests with browser
https://github.com/ant-tool/atool-test
Last synced: 3 months ago
JSON representation
Test tool based on dora & webpack, run tests with browser
- Host: GitHub
- URL: https://github.com/ant-tool/atool-test
- Owner: ant-tool
- Created: 2015-12-14T05:11:22.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-01-23T07:36:03.000Z (about 7 years ago)
- Last Synced: 2024-10-12T05:52:35.980Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 71.3 KB
- Stars: 14
- Watchers: 6
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
Awesome Lists containing this project
README
# atool-test
[![NPM version](https://img.shields.io/npm/v/atool-test.svg?style=flat)](https://npmjs.org/package/atool-test)
[![Build Status](https://img.shields.io/travis/ant-tool/atool-test.svg?style=flat)](https://travis-ci.org/ant-tool/atool-test)
[![Coverage Status](https://img.shields.io/coveralls/ant-tool/atool-test.svg?style=flat)](https://coveralls.io/r/ant-tool/atool-test)Simple configuration, focus more on the writing tests.
## Built-in
- [mocha](http://mochajs.org/)
- [chai](http://chaijs.com/api)
- [sinon](http://sinonjs.org/)## Usage
> Add `-test.js` or `-spec.js` suffix with your test files
```
"srcipts": {
"test": "atool-test"
}
```with options:
```
atool-test --port 9888 --no-chai --no-coverage --keep
```## Options
- `-p, --port`: server port, default is 9876;
- `--no-coverage`: without coverage output;
- `--no-chai`: run test without chai;
- `-k, --keep`: keep process after tests, for browser test;
- `--config `: custom config path, default is webpack.config.js';
- [mocha-phantomjs options](https://github.com/nathanboktae/mocha-phantomjs#usage)## Custom Assert
> atool-test --no-chai
- expectjs: `npm install expect.js --save-dev`
- shouldjs: `npm install should --save-dev````
// test code
import expect from 'expect.js';
```## Part Of test Files
If you want to test with part of files, custom `cwd/webpack.config.js`:
```
module.exports = function(webpackConfig) {
webpackConfig.atoolTestSpec = ['./tests/moduleA-test.js', './tests/**/*-spec.js'];
return webpackConfig;
};
```support glob files;
## Html Extra Files
custom `cwd/webpack.config.js`:
```
module.exports = function(webpackConfig) {
webpackConfig.htmlWebpackPlugin = {
files: {
js: ['xx.js'],
css: ['xx.css']
}
};
return webpackConfig;
};
```
base file path: `/tests`## Browser Test & Debug
Run with `--keep && --no-coverage` option, open `http://127.0.0.1:${port}/tests/runner.html` in your browser.