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.

20 lines
430 B

7 years ago
import test from 'ava';
const cwd = process.cwd();
7 years ago
const pkgPath = require.resolve('../');
test.afterEach.always(() => {
process.chdir(cwd);
delete require.cache[pkgPath];
});
test.serial(`exports root module`, t => {
7 years ago
process.chdir('test/helpers/package');
t.is(require(pkgPath), 'package');
7 years ago
});
test.serial(`exports undfined if there's no root module`, t => {
process.chdir('/');
t.is(require(pkgPath), undefined);
});