Skip to content

Commit

Permalink
feat: add mocha script
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jan 28, 2018
1 parent 73efd90 commit 4efb9ab
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions templates/app/package-scripts.js.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ const linters = {
}

<%_ if (mocha) { _%>
let test = 'mocha --forbid-only "test/**/*.test.<%- _ext %>"'
let mocha = 'mocha --forbid-only "test/**/*.test.<%- _ext %>"'
if (process.env.CI) {
if (process.env.CIRCLECI) {
// add mocha junit reporter
test = crossEnv(`MOCHA_FILE=reports/mocha.xml ${test} --reporter mocha-junit-reporter`)
mocha = crossEnv(`MOCHA_FILE=reports/mocha.xml ${mocha} --reporter mocha-junit-reporter`)
// add eslint reporter
linters.eslint.script = `${linters.eslint.script} --format junit --output-file reports/eslint.xml`
<%_ if (ts) { _%>
Expand All @@ -43,12 +43,12 @@ if (process.env.CI) {
// add code coverage reporting with nyc
const nyc = 'nyc --nycrc-path node_modules/@dxcli/nyc-config/.nycrc'
const nycReport = `${nyc} report --reporter text-lcov > coverage.lcov`
test = series(`${nyc} ${test}`, nycReport)
mocha = series(`${nyc} ${mocha}`, nycReport)
}
test = concurrent({
let test = concurrent({
...linters,
test: series(<%- ts ? "'nps build', " : ''%>test),
test: series(<%- ts ? "'nps build', " : ''%>mocha),
})
if (process.env.CI) test = series(mkdirp('reports'), test)
Expand All @@ -66,6 +66,9 @@ module.exports = {
<%_ } _%>
lint: concurrent(linters),
test,
<%_ if (mocha) { _%>
mocha,
<%_ } _%>
<%_ if (semantic_release) { _%>
release: 'semantic-release -e @dxcli/semantic-release',
<%_ } _%>
Expand Down

0 comments on commit 4efb9ab

Please sign in to comment.