UNPKG

this

Version:

Traverses up the directory tree and returns the first module found

15 lines (11 loc) 318 B
import test from 'ava'; const cwd = process.cwd(); const pkgPath = require.resolve('../'); test.afterEach.always(() => { process.chdir(cwd); delete require.cache[pkgPath]; }); test.serial(`throws exceptions`, t => { process.chdir('test/helpers/package-with-exception'); t.throws(() => require(pkgPath)); });