istanbuljs / istanbuljs/istanbuljs.github.io

Add a sonar tutorial

Open
#137 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
25
Forks
22
PR merge metrics
No merged PRs in 30d

Description

It would be great to help people to setup nyc with sonar.

Here is my setup:

```
npm install xunit-file --save-dev
```

add the following to the mocha command:

```
--reporter xunit-file --reporter-options file='./report/test-all.xml'
```

---

This is what I use (typescript + webpack + react) :

```
nyc mocha-webpack --webpack-config webpack.coverage.config.js \"(tests|web_modules)/**/*.test.\\?(ts|tsx)\" --require source-map-support/register --reporter mocha-sonar-reporter --reporter-options file='./coverage/TEST-xunit.xml'
```

webpack config:

```

// Enable sourcemaps for debugging webpack's output.
devtool: "cheap-module-source-map",
module: {
loaders: [
{
test: /\.tsx{0,1}?$/,
exclude: [/node_modules/, /json/],
loaders: ['istanbul-instrumenter', "babel-loader", "ts-loader"]
}
]
}

plugins: [
// Allow to define React as a global variable for JSX/TSX.
new webpack.ProvidePlugin({"React": "react",}),
]
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.