Contenu connexe Similaire à Ci2d - The Colossal Hood For Agile Development And Deployment (20) Ci2d - The Colossal Hood For Agile Development And DeploymentNotes de l'éditeur Add Istanbul and mocha modulesDemo.jsfunction nextPrime(n) {var smaller; n = Math.floor(n); if (n >= 2) { smaller = 1; while (smaller * smaller <= n) { n++; smaller = 2; while ((n % smaller > 0) && (smaller * smaller <= n)) { smaller++; } } return n; } else { return 2; }}module.exports.nextPrime = nextPrime;3) Test Case using mochavar assert = require('assert') , demo = require('./../routes/demo'); suite('nextPrime', function() { test('nextPrime should return the next prime number', function() {assert.equal(11, demo.nextPrime(7)); }); test('zero and one are not prime numbers', function() {assert.equal(2, demo.nextPrime(0));assert.equal(2, demo.nextPrime(1)); });});4) Following command as runnerREM @start /b cmd /c mocha -R lcov --uitdd > coverage/coverage.lcov@start /b cmd /c mocha -R xunit --uitdd > coverage/TEST-all.xml@start /b cmd /c istanbul cover routes\demo.js @ping -n 10 127.0.0.1 > nul@start /b cmd /c node public\javascripts\common\finalDest.js coverage\lcov.info coverage\coverage.lcov5) Sonar properties# Required metadatasonar.projectKey=TMSWebsonar.projectName=TMSWebsonar.projectVersion=1.0# Comma-separated paths to directories with sources (required)sonar.sources=routes,test# Languagesonar.language=js# Encoding of sources filessonar.sourceEncoding=UTF-8sonar.host.url = http://localhost:9000sonar.tests=test# To import the LCOV reportsonar.javascript.jstestdriver.reportsPath=coveragesonar.javascript.lcov.reportPath=coverage/coverage.lcovsonar.dynamicAnalysis=reuseReports6) @start /b cmd /c E:\Naveen_Home\SONAR_SPACE\sonar-runner-2.3\bin\sonar-runner.batSonar java script plugin 1.4 Add Istanbul and mocha modulesDemo.jsfunction nextPrime(n) {var smaller; n = Math.floor(n); if (n >= 2) { smaller = 1; while (smaller * smaller <= n) { n++; smaller = 2; while ((n % smaller > 0) && (smaller * smaller <= n)) { smaller++; } } return n; } else { return 2; }}module.exports.nextPrime = nextPrime;3) Test Case using mochavar assert = require('assert') , demo = require('./../routes/demo'); suite('nextPrime', function() { test('nextPrime should return the next prime number', function() {assert.equal(11, demo.nextPrime(7)); }); test('zero and one are not prime numbers', function() {assert.equal(2, demo.nextPrime(0));assert.equal(2, demo.nextPrime(1)); });});4) Following command as runnerREM @start /b cmd /c mocha -R lcov --uitdd > coverage/coverage.lcov@start /b cmd /c mocha -R xunit --uitdd > coverage/TEST-all.xml@start /b cmd /c istanbul cover routes\demo.js @ping -n 10 127.0.0.1 > nul@start /b cmd /c node public\javascripts\common\finalDest.js coverage\lcov.info coverage\coverage.lcov5) Sonar properties# Required metadatasonar.projectKey=TMSWebsonar.projectName=TMSWebsonar.projectVersion=1.0# Comma-separated paths to directories with sources (required)sonar.sources=routes,test# Languagesonar.language=js# Encoding of sources filessonar.sourceEncoding=UTF-8sonar.host.url = http://localhost:9000sonar.tests=test# To import the LCOV reportsonar.javascript.jstestdriver.reportsPath=coveragesonar.javascript.lcov.reportPath=coverage/coverage.lcovsonar.dynamicAnalysis=reuseReports6) @start /b cmd /c E:\Naveen_Home\SONAR_SPACE\sonar-runner-2.3\bin\sonar-runner.batSonar java script plugin 1.4 Add Istanbul and mocha modulesDemo.jsfunction nextPrime(n) {var smaller; n = Math.floor(n); if (n >= 2) { smaller = 1; while (smaller * smaller <= n) { n++; smaller = 2; while ((n % smaller > 0) && (smaller * smaller <= n)) { smaller++; } } return n; } else { return 2; }}module.exports.nextPrime = nextPrime;3) Test Case using mochavar assert = require('assert') , demo = require('./../routes/demo'); suite('nextPrime', function() { test('nextPrime should return the next prime number', function() {assert.equal(11, demo.nextPrime(7)); }); test('zero and one are not prime numbers', function() {assert.equal(2, demo.nextPrime(0));assert.equal(2, demo.nextPrime(1)); });});4) Following command as runnerREM @start /b cmd /c mocha -R lcov --uitdd > coverage/coverage.lcov@start /b cmd /c mocha -R xunit --uitdd > coverage/TEST-all.xml@start /b cmd /c istanbul cover routes\demo.js @ping -n 10 127.0.0.1 > nul@start /b cmd /c node public\javascripts\common\finalDest.js coverage\lcov.info coverage\coverage.lcov5) Sonar properties# Required metadatasonar.projectKey=TMSWebsonar.projectName=TMSWebsonar.projectVersion=1.0# Comma-separated paths to directories with sources (required)sonar.sources=routes,test# Languagesonar.language=js# Encoding of sources filessonar.sourceEncoding=UTF-8sonar.host.url = http://localhost:9000sonar.tests=test# To import the LCOV reportsonar.javascript.jstestdriver.reportsPath=coveragesonar.javascript.lcov.reportPath=coverage/coverage.lcovsonar.dynamicAnalysis=reuseReports6) @start /b cmd /c E:\Naveen_Home\SONAR_SPACE\sonar-runner-2.3\bin\sonar-runner.batSonar java script plugin 1.4