     hinoki(source, lifetime, 'a').catch hinoki.BadFactoryError, (error) ->
       t.equal error.name, 'BadFactoryError'
       t.equal error.message, "factory for `a` has to be a function, object of factories or array of factories but is `number`"
-      t.equal 'string', typeof error.stack
-      t.ok error.stack.split('\n').length > 8
+      if Error.captureStackTrace?
+        t.equal 'string', typeof error.stack
+        t.ok error.stack.split('\n').length > 8
 
       t.deepEqual error.path, ['a']
       t.equal error.factory, 1

  hinoki(source, lifetime, 'a').catch hinoki.FactoryReturnedUndefinedError, (error) ->
    t.equal error.name, 'FactoryReturnedUndefinedError'
    t.equal error.message, "factory for `a` returned undefined"
    t.equal 'string', typeof error.stack
    t.ok error.stack.split('\n').length > 8

    t.deepEqual error.path, ['a']
    t.equal error.factory, a

  hinoki(source, lifetime, 'a').catch hinoki.ErrorInFactory, (error) ->
    t.equal error.name, 'ErrorInFactory'
    t.equal error.message, "error in factory for `a`. original error `Error: fail`"
    if Error.captureStackTrace?
      t.equal 'string', typeof error.stack
      t.ok error.stack.split('\n').length > 8

    t.deepEqual error.path, ['a']
    t.equal error.factory, a
