chore: add reports
MODIFY
package-scripts.js
package-scripts.js
@@ -2,18 +2,32 @@ const {
concurrent,
series,
setColors,
+ mkdirp,
} = require('nps-utils')
const script = (script, description) => description ? {script, description} : {script}
const hidden = script => ({script, hiddenFromHelp: true})
setColors(['dim'])
-const test = type => [
- `mocha test/commands/${type}/plain.test.ts`,
- `mocha test/commands/${type}/mocha.test.ts`,
- `mocha test/commands/${type}/typescript.test.ts`,
- `mocha test/commands/${type}/everything.test.ts`,
-]
+let test = type => {
+ let mocha = () => 'mocha --forbid-only'
+ if (process.env.CIRCLECI) {
+ const m = mocha()
+ mocha = type => `MOCHA_FILE=reports/mocha-${type}.xml ${m} --reporter mocha-junit-reporter`
+ }
+
+ let tests = concurrent([
+ `${mocha('plain')} test/commands/${type}/plain.test.ts`,
+ `${mocha('mocha')} test/commands/${type}/mocha.test.ts`,
+ `${mocha('typescript')} test/commands/${type}/typescript.test.ts`,
+ `${mocha('everything')} test/commands/${type}/everything.test.ts`,
+ ])
+ if (process.env.CI) {
+ const nyc = 'nyc --nycrc-path node_modules/@dxcli/dev-nyc-config/.nycrc'
+ return series(mkdirp('reports'), `${nyc} ${tests}`, `${nyc} report --reporter text-lcov > coverage.lcov`)
+ }
+ return tests
+}
module.exports = {
scripts: {
@@ -27,10 +41,10 @@ module.exports = {
},
test: {
default: series.nps('test.base', 'test.plugin', 'test.single', 'test.multi'),
- base: concurrent(test('base')),
- plugin: concurrent(test('plugin')),
- single: concurrent(test('single')),
- multi: concurrent(test('multi')),
+ base: test('base'),
+ plugin: test('plugin'),
+ single: test('single'),
+ multi: test('multi'),
},
release: hidden('semantic-release -e @dxcli/dev-semantic-release'),
},

MODIFY
package.json
package.json
"@types/yeoman-generator": "^2.0.1",
"@types/yosay": "^0.0.29",
"husky": "^0.14.3",
+ "mocha-junit-reporter": "^1.17.0",
"nps-utils": "^1.5.0",
"shelljs": "^0.8.1"
},

MODIFY
src/generators/app/index.ts
src/generators/app/index.ts
@@ -268,7 +268,7 @@ class App extends Generator {
}
this.fs.writeJSON(this.destinationPath('./package.json'), sortPjson(this.pjson))
this.fs.copyTpl(this.templatePath('editorconfig'), this.destinationPath('.editorconfig'), this)
- this.fs.copyTpl(this.templatePath('scripts/greenkeeper'), this.destinationPath('.circleci/greenkeeper'), this)
+ this.fs.copyTpl(this.templatePath('scripts/yarn'), this.destinationPath('.circleci/yarn'), this)
this.fs.copyTpl(this.templatePath('scripts/setup_git'), this.destinationPath('.circleci/setup_git'), this)
this.fs.copyTpl(this.templatePath('README.md.ejs'), this.destinationPath('README.md'), this)
this.fs.copyTpl(this.templatePath('circle.yml.ejs'), this.destinationPath('.circleci/config.yml'), this)

RENAME
templates/scripts/greenkeeper
templates/scripts/yarn
chore: add reports