Open serut opened 8 years ago
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",}), ]
@serut I don't do a ton of front-end coding these days, so I'm not the best person to write this tutorial -- would love the help if you wanted to help contribute:
https://github.com/istanbuljs/istanbuljs.github.io
It would be great to help people to setup nyc with sonar.
Here is my setup:
add the following to the mocha command:
This is what I use (typescript + webpack + react) :
webpack config: