GithubHelp home page GithubHelp logo

classicvalues / eslint-junit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from crowdstrike/eslint-junit

0.0 1.0 0.0 94 KB

A eslint reporter that creates compatible junit xml files

License: Apache License 2.0

JavaScript 100.00%

eslint-junit's Introduction

Downloads Downloads NPM Version Dependencies Dev Dependencies License Build Status Code Climate Test Coverage

eslint-junit

A eslint reporter that creates compatible junit xml files

Installation

yarn add --dev eslint-junit

Usage

Simply run:

eslint -f ./node_modules/eslint-junit/index.js

Configuration

eslint-junit offers four configurations based on environment variables or a eslint-junit key defined in package.json. All configuration values should be strings.

Variable Name Description Default
ESLINT_SUITE_NAME name attribute of <testsuites> "eslint tests"
ESLINT_JUNIT_OUTPUT File path to save the output. "./junit.xml"
ESLINT_JUNIT_CLASSNAME Template string for the classname attribute of <testcase>. "{ruleId}"
ESLINT_JUNIT_TITLE Template string for the name attribute of <testcase>. "{line} : {source}"

Example:

ESLINT_SUITE_NAME="Eslint Style Tests" ESLINT_JUNIT_OUTPUT="./artifacts/eslint-junit.xml" eslint

You can also define a eslint-junit key in your package.json. All are string values.

{
  ...
  "eslint-junit": {
    "suiteName": "eslint tests",
    "output": "./eslint-junit.xml",
    "classNameTemplate": "{ruleId}",
    "titleTemplate": "{line} : {source}"
  }
}

For the following case:

function test (a) {
  a = '1';
}

The default output:

<testsuites name="eslint tests">
  <testsuite errors="1" failures="0" name="/test.js" skipped="0" tests="1" time="1" timestamp="2017-09-06T20:04:53">
    <testcase classname="no-param-reassign" name="2 :  a = '1';" time="1">
      <failure>Assignment to function parameter &apos;a&apos;.</failure>
    </testcase>
  </testsuite>
</testsuites>

Changing the classNameTemplate and titleTemplate:

ESLINT_JUNIT_CLASSNAME="{ruleId}" ESLINT_JUNIT_TITLE="{source}" eslint
<testsuites name="eslint tests">
  <testsuite errors="1" failures="0" name="/utils/getOptions.js" skipped="0" tests="1" time="1" timestamp="2017-09-06T20:04:53">
    <testcase classname="no-param-reassign" name="    pathToResolve = path.dirname(pathToResolve);" time="1">
      <failure>Assignment to function parameter &apos;pathToResolve&apos;.</failure>
    </testcase>
  </testsuite>
</testsuites>

eslint-junit's People

Contributors

palmerj3 avatar jcgertig avatar yangshun avatar danjamin avatar wedvich avatar cmalard avatar joezeng avatar crudo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.