Skip to content

Commit

Permalink
chore: improve coverage (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
ofrobots committed Sep 25, 2017
1 parent 420804d commit fbfe641
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 51 deletions.
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}`)}`);
}
});

0 comments on commit fbfe641

Please sign in to comment.