1.0.1 • Published 7 years ago

vbuild-karma v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

vbuild-karma

NPM version NPM downloads Build Status donate

Install

This module requires vbuild to be installed as devDependency.

yarn add vbuild vbuild-karma --dev

Usage

// 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

{
  "scripts": {
    "test": "vbuild -c vbuild.karma.js"
  }
}

You can run the example by:

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.

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, Released under the MIT License. Authored and maintained by egoist with help from contributors (list).

egoistian.com · GitHub @egoist · Twitter @rem_rin_rin