Skip to content

Commit

Permalink
fix: use new linter rules
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Feb 1, 2018
1 parent 37ca4cc commit 2fbd4f9
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 59 deletions.
4 changes: 2 additions & 2 deletions package-scripts.js
Expand Up @@ -23,8 +23,8 @@ const tests = testTypes.map(cmd => {
const base = path.join('test/commands', cmd)
sh.pushd(base)
let tests = _(sh.ls())
.map(t => [t.split('.')[0], path.join(base, t)])
.map(([t, s]) => [t, process.env.CIRCLECI ? `MOCHA_FILE=reports/mocha-${t}.xml ${mocha} --reporter mocha-junit-reporter ${s}` : `${mocha} ${s}`])
.map(t => [t.split('.')[0], path.join(base, t)])
.map(([t, s]) => [t, process.env.CIRCLECI ? `MOCHA_FILE=reports/mocha-${t}.xml ${mocha} --reporter mocha-junit-reporter ${s}` : `${mocha} ${s}`])
sh.popd()
tests = process.env.TEST_SERIES === '1' ?
series(...tests.map(t => t[1]).value()) :
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -32,7 +32,7 @@
"@types/yosay": "^0.0.29",
"chai": "^4.1.2",
"eslint": "^4.16.0",
"eslint-config-anycli": "^1.3.0",
"eslint-config-anycli": "^1.3.1",
"execa": "^0.9.0",
"fancy-test": "^0.6.6",
"fs-extra": "^5.0.0",
Expand Down
24 changes: 12 additions & 12 deletions templates/test/command.test.js.ejs
Expand Up @@ -7,24 +7,24 @@ const command = '<%- name %>'

describe(command, () => {
test
.stdout()
.stdout()
<%_ if (type === 'single') { _%>
.do(() => cmd.run([]))
.do(() => cmd.run([]))
<%_ } else { _%>
.command([command])
.command([command])
<%_ } _%>
.it('runs hello', ctx => {
expect(ctx.stdout).to.contain('hello world from <%- name %>!')
})
.it('runs hello', ctx => {
expect(ctx.stdout).to.contain('hello world from <%- name %>!')
})

test
.stdout()
.stdout()
<%_ if (type === 'single') { _%>
.do(() => cmd.run(['--name', 'jeff']))
.do(() => cmd.run(['--name', 'jeff']))
<%_ } else { _%>
.command([command, '--name', 'jeff'])
.command([command, '--name', 'jeff'])
<%_ } _%>
.it('runs hello --name jeff', ctx => {
expect(ctx.stdout).to.contain('hello jeff from <%- name %>!')
})
.it('runs hello --name jeff', ctx => {
expect(ctx.stdout).to.contain('hello jeff from <%- name %>!')
})
})
82 changes: 41 additions & 41 deletions test/run.js
Expand Up @@ -39,46 +39,46 @@ module.exports = file => {

describe(cmd, () => {
fancy
.retries(CI ? 1 : 0)
.do(() => {
switch (cmd) {
case 'base':
build(cmd, name)
sh.exec('yarn test')
break
case 'plugin':
build(cmd, name)
sh.exec('yarn test')
sh.exec('node ./bin/run')
sh.exec('node ./bin/run --help')
break
case 'single':
build(cmd, name)
sh.exec('yarn test')
sh.exec('node ./bin/run -v')
sh.exec('node ./bin/run')
sh.exec('node ./bin/run --help')
break
case 'multi':
build(cmd, name)
sh.exec('yarn test')
sh.exec('node ./bin/run -v')
sh.exec('node ./bin/run version')
sh.exec('node ./bin/run hello')
sh.exec('node ./bin/run help hello')
sh.exec('node ./bin/run hello --help')
break
case 'command':
build('plugin', name)
generate('command foo:bar:baz --defaults --force')
sh.exec('yarn test')
sh.exec('node ./bin/run hello')
sh.exec('node ./bin/run foo:bar:baz')
sh.exec('node ./bin/run help foo:bar:baz')
sh.exec('node ./bin/run foo:bar:baz --help')
break
}
})
.it([cmd, name].join(':'))
.retries(CI ? 1 : 0)
.do(() => {
switch (cmd) {
case 'base':
build(cmd, name)
sh.exec('yarn test')
break
case 'plugin':
build(cmd, name)
sh.exec('yarn test')
sh.exec('node ./bin/run')
sh.exec('node ./bin/run --help')
break
case 'single':
build(cmd, name)
sh.exec('yarn test')
sh.exec('node ./bin/run -v')
sh.exec('node ./bin/run')
sh.exec('node ./bin/run --help')
break
case 'multi':
build(cmd, name)
sh.exec('yarn test')
sh.exec('node ./bin/run -v')
sh.exec('node ./bin/run version')
sh.exec('node ./bin/run hello')
sh.exec('node ./bin/run help hello')
sh.exec('node ./bin/run hello --help')
break
case 'command':
build('plugin', name)
generate('command foo:bar:baz --defaults --force')
sh.exec('yarn test')
sh.exec('node ./bin/run hello')
sh.exec('node ./bin/run foo:bar:baz')
sh.exec('node ./bin/run help foo:bar:baz')
sh.exec('node ./bin/run foo:bar:baz --help')
break
}
})
.it([cmd, name].join(':'))
})
}
6 changes: 3 additions & 3 deletions yarn.lock
Expand Up @@ -1056,9 +1056,9 @@ eslint-ast-utils@^1.0.0:
lodash.get "^4.4.2"
lodash.zip "^4.2.0"

eslint-config-anycli@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/eslint-config-anycli/-/eslint-config-anycli-1.3.0.tgz#35f970a1b382aa5ebe1353b96a6855461b4a1de0"
eslint-config-anycli@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/eslint-config-anycli/-/eslint-config-anycli-1.3.1.tgz#e05fefcdbdffdd3e74069dac5252a8bc70ae7eb2"
dependencies:
eslint-config-xo-space "^0.17.0"
eslint-plugin-mocha "^4.11.0"
Expand Down

0 comments on commit 2fbd4f9

Please sign in to comment.