Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improve coverage #57

Merged
merged 1 commit into from
Sep 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions test/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,3 @@ export async function withFixtures(

return result;
}

// Problem: the following doesn't quite work with Ava. Ava expects direct calls
// to `test`, and if it doesn't find them, it thinks that there do not exist
// any tests in a file.
// TODO: figure out a solution. Without this, the users of withFixtures have to
// remember to use test.serial rather than test.
export async function testWithFixtures(
name: string, fixtures: Fixtures, testFn: Test) {
return await withFixtures(fixtures, async () => {
// The tests are run serially because we chdir to temp directory.
return await test.serial(name, testFn);
});
}
1 change: 0 additions & 1 deletion test/test-clean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ test.failing.serial(
'should gracefully error if tsconfig is missing', async t => {
await withFixtures({}, async () => {
await clean(OPTIONS);
t.pass();
});
});

Expand Down
20 changes: 7 additions & 13 deletions test/test-kitchen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,18 @@ const execOpts = {
cwd: `${stagingPath}/kitchen`
};

console.log(`${chalk.blue(`${__filename} staging area: ${stagingPath}`)}`);

/**
* Create a staging directory with temp fixtures used
* to test on a fresh application.
*/
test.before(async () => {
try {
await execp('npm pack');
const tarball = `${pkg.name}-${pkg.version}.tgz`;
await renamep(tarball, `${stagingPath}/gts.tgz`);
await ncpp('test/fixtures', `${stagingPath}/`);
await execp('npm install', execOpts);
} catch (e) {
console.error('Failed to prepare test staging sandbox.');
console.error(e);
throw e;
}
await execp('npm pack');
const tarball = `${pkg.name}-${pkg.version}.tgz`;
await renamep(tarball, `${stagingPath}/gts.tgz`);
await ncpp('test/fixtures', `${stagingPath}/`);
await execp('npm install', execOpts);
});

test.serial('init', async t => {
Expand Down Expand Up @@ -95,7 +91,5 @@ test.serial('clean', async t => {
test.after.always('cleanup staging', async () => {
if (!keep) {
stagingDir.removeCallback();
} else {
console.log(`${chalk.blue(`${__filename} staging area: ${stagingPath}`)}`);
}
});