grunt-simple-istanbul

2019-06-14 admin

grunt-simple-istanbul是什么

什么是grunt-simple-istanbul,A grunt wrapper for istanbul

grunt-simple-istanbul使用教程帮助文档

Build Status downloads npm Code Climate Test Coverage dependencies

NPM info

grunt-simple-istanbul

A grunt wrapper for istanbul

Getting Started

If you haven’t used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you’re familiar with that process, you may install this plugin with this command:

npm install grunt-simple-istanbul --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with:

grunt.loadNpmTasks('grunt-simple-istanbul');

Alternatively, install and use task-master, and it will handle this (and a lot more!) for you.

The “istanbul” task

This module uses the simple-cli library to create a simple wrapper around istanbul.

Overview

The istanbul task is a multiTask, where the target is the istanbul command to run. You can configure as many istanbul commands as are useful to you either in your grunt.initConfig call or, as mentioned above, by using task-master. Options to the istanbul binary go under options. However, the special key simple indicates how this task should be run. See the examples below or the documentation for simple-cli.

grunt.initConfig({
  istanbul: {
    // istanbul instrument app --output instrumented -x **/node_modules/** -x **/coverage/** -x **/instrumented/** --no-compact true
    instrument: {
      options: {
        output: 'instrumented',
        x: ['**/node_modules/**', '**/coverage/**', '**/instrumented/**'],
        noCompact: true,
        simple: {
          args: ['app']
        }
      }
    },
    // istanbul report --root /Users/foo/bar/my-repo/coverage --dir /Users/foo/bar/my-repo/coverage
    report: {
      options: {
        root: __dirname + '/coverage',
        dir: __dirname + '/coverage'
      }
    },
    // istanbul cover grunt coverage:unit --hook-run-in-context --root server --dir /Users/foo/bar/my-repo/coverage/unit -x **/node_modules/** -x **/public/** -x **/instrumented/**
    coverUnit: {
      options: {
        hookRunInContext: true,
        root: 'server'
        dir: __dirname + '/coverage/unit',
        x: ['**/node_modules/**', '**/public/**', '**/instrumented/**'],
        simple: {
          cmd: 'cover'
          args: ['grunt', 'coverage:unit']
        }
      }
    }
  }
});

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-67296.html

文章标题:grunt-simple-istanbul

回到顶部