require! {
  'end-child-processes'
  'fs-extra' : fs
  'glob'
  'path'
  'rimraf'
  'shelljs/global'
  'tmp'
  'touch'
}


module.exports = ->

  @set-default-timeout 2000


  @Before ->
    @root-dir = tmp.dir-sync unsafe-cleanup: yes


  @After (scenario, done) ->
    if scenario.is-failed!
      console.log "\ntest artifacts are located in #{@root-dir.name}"
    else
      @root-dir.remove-callback!
    end-child-processes done


  @Before tags: ['@verbose'], ->
    @verbose = on


  @After tags: ['@verbose'], ->
    @verbose = off


  @Before tags: ['@debug'], ->
    @debug = on


  @After tags: ['@debug'], ->
    @debug = off

require! {
  'end-child-processes'
  'fs-extra' : fs
  'glob'
  'path'
  'rimraf'
  'shelljs/global'
  'tmp'
  'touch'
  'wait' : {wait}
}


module.exports = ->

  @set-default-timeout 2000


  @Before ->
    @root-dir = tmp.dir-sync unsafe-cleanup: yes


  @After (scenario, done) ->
    end-child-processes ~>
      if scenario.is-failed!
        console.log "\ntest artifacts are located in #{@root-dir.name}"
        done!
      else
        wait 1, ~>
          @root-dir.remove-callback!
          done!


  @Before tags: ['@verbose'], ->
    @verbose = on


  @After tags: ['@verbose'], ->
    @verbose = off


  @Before tags: ['@debug'], ->
    @debug = on


  @After tags: ['@debug'], ->
    @debug = off
