     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.CircularDependencyError, (error) ->
      t.equal error.name, 'CircularDependencyError'
      t.equal error.message, "circular dependency `a <- a`"
      t.equal 'string', typeof error.stack
      t.ok error.stack.split('\n').length > 8

      t.deepEqual error.path, ['a', 'a']
      t.deepEqual lifetime, {}

  hinoki(source, lifetime, 'a').catch hinoki.FactoryReturnedUndefinedError, (error) ->
    t.equal error.name, 'FactoryReturnedUndefinedError'
    t.equal error.message, "factory for `a` returned undefined"
    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
