Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/egoist/vbuild-karma
Run unit tests with vbuild and Karma
https://github.com/egoist/vbuild-karma
jasmine karma phantomjs unit-testing vbuild webpack
Last synced: 22 days ago
JSON representation
Run unit tests with vbuild and Karma
- Host: GitHub
- URL: https://github.com/egoist/vbuild-karma
- Owner: egoist
- License: mit
- Created: 2017-02-05T07:07:58.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-12-25T14:31:48.000Z (almost 3 years ago)
- Last Synced: 2024-10-07T15:48:39.121Z (29 days ago)
- Topics: jasmine, karma, phantomjs, unit-testing, vbuild, webpack
- Language: JavaScript
- Homepage:
- Size: 87.9 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vbuild-karma
[![NPM version](https://img.shields.io/npm/v/vbuild-karma.svg?style=flat)](https://npmjs.com/package/vbuild-karma) [![NPM downloads](https://img.shields.io/npm/dm/vbuild-karma.svg?style=flat)](https://npmjs.com/package/vbuild-karma) [![Build Status](https://img.shields.io/circleci/project/egoist/vbuild-karma/master.svg?style=flat)](https://circleci.com/gh/egoist/vbuild-karma) [![donate](https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000&style=flat)](https://github.com/egoist/donate)
## Install
This module requires `vbuild` to be installed as devDependency.
```bash
yarn add vbuild vbuild-karma --dev
```## Usage
```js
// config file: vbuild.karma.js
const karma = require('vbuild-karma')module.exports = {
// in test we don't need to split vendor code and minimize it
vendor: false,
minimize: false,
// run custom build process
run(webpackConfig) {
karma(webpackConfig)
}
}
```We use `karma-phantomjs-launcher` `karma-spec-reporter` `karma-jasmine` `jasmine-core` by default.
In Continuous Integration Environment like CircleCi and TravisCi, the `singleRun` mode of Karma will be enabled.
**Configure npm scripts**
```js
{
"scripts": {
"test": "vbuild -c vbuild.karma.js"
}
}
```You can run the example by:
```bash
git clone https://github.com/egoist/vbuild-karma.git
cd vbuild-karma
yarn
yarn example
```## API
### karma(webpackConfig, testFiles, karmaConfig)
#### webpackConfig
Final webpack config from vbuild
#### testFiles
Default: `['test/unit/**/*.test.js']`
#### karmaConfig
Type: `object` `string`
When providing an `object` as `karmaConfig`, it will be assigned to [default karma config we use](/index.js#L9).
When providing a `string` as `karmaConfig`, it will be treated as the path to karma config file, eg: `./test/unit/karma.conf.js`, and it will totally override the default karma config.
## Contributing
1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D## Author
**vbuild-karma** © [egoist](https://github.com/egoist), Released under the [MIT](./LICENSE) License.
Authored and maintained by egoist with help from contributors ([list](https://github.com/egoist/vbuild-karma/contributors)).> [egoistian.com](https://egoistian.com) · GitHub [@egoist](https://github.com/egoist) · Twitter [@rem_rin_rin](https://twitter.com/rem_rin_rin)