You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

19 lines
430 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(`exports root module`, t => {
process.chdir('test/helpers/package');
t.is(require(pkgPath), 'package');
});
test.serial(`exports undfined if there's no root module`, t => {
process.chdir('/');
t.is(require(pkgPath), undefined);
});