Skip to content

Commit

Permalink
no need to call t.end() in async functions
Browse files Browse the repository at this point in the history
as they return a promise which AVA handles for us
  • Loading branch information
sindresorhus committed Oct 4, 2015
1 parent 985ea54 commit 15b1e24
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,21 @@ test('tempWrite(string)', async t => {

t.is(fs.readFileSync(filepath, 'utf8'), 'unicorn');
t.is(path.basename(filepath), 'test.png');
t.end();
});

test('tempWrite(buffer)', async t => {
const filepath = await fn(new Buffer('unicorn'), 'test.png');

t.is(fs.readFileSync(filepath, 'utf8'), 'unicorn');
t.end();
});

test('tempWrite(string, path)', async t => {
const filepath = await fn(new Buffer('unicorn'), 'foo/bar/test.png');

t.is(fs.readFileSync(filepath, 'utf8'), 'unicorn');
t.regexTest(/foo\/bar\/test\.png$/, filepath);
t.end();
});

test('tempWrite.sync()', t => {
t.is(fs.readFileSync(fn.sync('unicorn'), 'utf8'), 'unicorn');
t.end();

This comment has been minimized.

Copy link
@SamVerschueren

SamVerschueren Oct 4, 2015

Contributor

This is not an async function so t.end should be called here ;).

});

2 comments on commit 15b1e24

@sindresorhus
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SamVerschueren Fyi, just realized this ;)

avajs/ava@2cb0ae7

@SamVerschueren
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks!

Please sign in to comment.