Skip to content

Commit

Permalink
fix: fix defaulting root
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jan 25, 2018
1 parent e3c6902 commit 275ae1e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
7 changes: 2 additions & 5 deletions src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import * as _ from 'lodash'

import {Options} from '.'

export default (async (next, __, args: string[] | string, opts: Options) => {
_.defaults(opts, {
root: module.parent!.parent!.filename
})
await run(_.castArray(args), {root: opts.root})
export default (async (next, __, args: string[] | string, opts = {}) => {
await run(_.castArray(args), {root: opts.root || module.parent!.parent!.filename})
await next({})
}) as Plugin<{}, (string[] | string), Partial<Options>>
8 changes: 2 additions & 6 deletions src/hook.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {Engine} from '@dxcli/engine'
import {Plugin} from 'fancy-mocha'
import * as _ from 'lodash'

import {Options} from './options'

Expand All @@ -16,12 +15,9 @@ import {Options} from './options'
* @param hookOpts - options to pass to hook. Config object will be passed automatically.
* @param opts - test options
*/
export default (async (next, __, event, hookOpts, opts: Options) => {
_.defaults(opts, {
root: module.parent!.parent!.filename
})
export default (async (next, __, event, hookOpts, opts = {}) => {
const engine = new Engine()
await engine.load(opts.root)
await engine.load(opts.root || module.parent!.parent!.filename)
await engine.runHook(event!, hookOpts || {})
await next({})
}) as Plugin<{}, string, object, Partial<Options>>

0 comments on commit 275ae1e

Please sign in to comment.