@linaj/plugin-karma

0.1.0 • Public • Published

@linaj/plugin-karma

Automatic (headless) browser testing with Karma.

Introduction

This plugin pre-configures Karma, Jasmine for you so that you can run the tests without any configurations.

Install

yarn add @linaj/plugin-karma --dev

How to use

In your lazy.config.js:

module.exports = {
  plugins: [
    {
      resolve: '@linaj/plugin-karma'
    }
  ]
}

This plugin injected a new command to lazy CLI: lazy test:unit which is a command running in lazy's test mode.

To run it easier, you can configure this in npm scripts:

{
  "name": "my-project",
  "scripts": {
    "test": "lazy test:unit",
    "build": "lazy --prod",
    "start": "lazy --serve"
  },
  "devDependencies": {
    "lazy": "^12.0.0"
  }
}

Now you can run npm test instead.

Test File Patterns

By default this plugin use **/*.{test,spec}.{js,ts} (excluded node_modules) as test files, you can change this to any minimatch pattern (note the quotes to avoid shell expansion):

lazy test:unit "**/*.spec.coffee"

Coverage Report

Use --coverage flag to show code coverage and generate coverage report to ./coverage folder.

Watching Files

Use --watch flag to watch test files.

Running on CI

To run your tests in Continuous Integration Platforms like CircleCI, you will need Chrome installed in your test environment.

Readme

Keywords

none

Package Sidebar

Install

npm i @linaj/plugin-karma

Weekly Downloads

0

Version

0.1.0

License

none

Unpacked Size

6.61 kB

Total Files

5

Last publish

Collaborators

  • linaijiao