Skip to content

Commit

Permalink
test: update ava to version 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
greenkeeper[bot] authored and pvdlg committed Dec 26, 2018
1 parent 7d6b7f0 commit 9bb3dcd
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 66 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"url-join": "^4.0.0"
},
"devDependencies": {
"ava": "^0.25.0",
"ava": "^1.0.1",
"clear-module": "^3.0.0",
"codecov": "^3.0.0",
"commitizen": "^3.0.0",
Expand Down
6 changes: 3 additions & 3 deletions test/add-channel.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ test.serial('Throw error if cannot read current release', async t => {
.times(4)
.reply(500);

const error = await t.throws(
const error = await t.throwsAsync(
addChannel(pluginConfig, {
env,
options,
Expand Down Expand Up @@ -301,7 +301,7 @@ test.serial('Throw error if cannot create missing current release', async t => {
.times(4)
.reply(500);

const error = await t.throws(
const error = await t.throwsAsync(
addChannel(pluginConfig, {
env,
options,
Expand Down Expand Up @@ -337,7 +337,7 @@ test.serial('Throw error if cannot update release', async t => {
.times(4)
.reply(404);

const error = await t.throws(
const error = await t.throwsAsync(
addChannel(pluginConfig, {
env,
options,
Expand Down
4 changes: 2 additions & 2 deletions test/find-sr-issue.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ test.serial('Retries 4 times', async t => {
.times(4)
.reply(422);

const error = await t.throws(findSRIssues(client, title, owner, repo));
const error = await t.throwsAsync(findSRIssues(client, title, owner, repo));

t.is(error.status, 422);
t.true(github.isDone());
Expand All @@ -123,7 +123,7 @@ test.serial('Do not retry on 401 error', async t => {
)
.reply(401);

const error = await t.throws(findSRIssues(client, title, owner, repo));
const error = await t.throwsAsync(findSRIssues(client, title, owner, repo));

t.is(error.status, 401);
t.true(github.isDone());
Expand Down
11 changes: 5 additions & 6 deletions test/get-client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,11 @@ test('Use the same throttler when retrying', async t => {
},
})({githubToken: 'token'});

await t.throws(github.repos.createRelease());

const {time: a} = await t.throws(request.getCall(0).returnValue);
const {time: b} = await t.throws(request.getCall(1).returnValue);
const {time: c} = await t.throws(request.getCall(2).returnValue);
const {time: d} = await t.throws(request.getCall(3).returnValue);
await t.throwsAsync(github.repos.createRelease());
const {time: a} = await t.throwsAsync(request.getCall(0).returnValue);
const {time: b} = await t.throwsAsync(request.getCall(1).returnValue);
const {time: c} = await t.throwsAsync(request.getCall(2).returnValue);
const {time: d} = await t.throwsAsync(request.getCall(3).returnValue);

// Each retry should be done after `coreRate` ms
t.true(inRange(b - a, coreRate - 50, coreRate + 50));
Expand Down
16 changes: 9 additions & 7 deletions test/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ test.serial('Verify GitHub auth', async t => {
.get(`/repos/${owner}/${repo}`)
.reply(200, {permissions: {push: true}});

await t.notThrows(t.context.m.verifyConditions({}, {cwd, env, options, logger: t.context.logger}));
await t.notThrowsAsync(t.context.m.verifyConditions({}, {cwd, env, options, logger: t.context.logger}));

t.true(github.isDone());
});
Expand All @@ -61,7 +61,7 @@ test.serial('Verify GitHub auth with publish options', async t => {
.get(`/repos/${owner}/${repo}`)
.reply(200, {permissions: {push: true}});

await t.notThrows(t.context.m.verifyConditions({}, {cwd, env, options, logger: t.context.logger}));
await t.notThrowsAsync(t.context.m.verifyConditions({}, {cwd, env, options, logger: t.context.logger}));

t.true(github.isDone());
});
Expand All @@ -85,7 +85,7 @@ test.serial('Verify GitHub auth and assets config', async t => {
.get(`/repos/${owner}/${repo}`)
.reply(200, {permissions: {push: true}});

await t.notThrows(t.context.m.verifyConditions({assets}, {cwd, env, options, logger: t.context.logger}));
await t.notThrowsAsync(t.context.m.verifyConditions({assets}, {cwd, env, options, logger: t.context.logger}));

t.true(github.isDone());
});
Expand All @@ -106,7 +106,9 @@ test.serial('Throw SemanticReleaseError if invalid config', async t => {
repositoryUrl: 'invalid_url',
};

const errors = [...(await t.throws(t.context.m.verifyConditions({}, {cwd, env, options, logger: t.context.logger})))];
const errors = [
...(await t.throwsAsync(t.context.m.verifyConditions({}, {cwd, env, options, logger: t.context.logger}))),
];

t.is(errors[0].name, 'SemanticReleaseError');
t.is(errors[0].code, 'EINVALIDASSETS');
Expand Down Expand Up @@ -353,7 +355,7 @@ test.serial('Verify, release and notify success', async t => {
.post(`${uploadUri}?name=${escape('other_file.txt')}&label=${escape('Other File')}`)
.reply(200, {browser_download_url: otherAssetUrl});

await t.notThrows(t.context.m.verifyConditions({}, {cwd, env, options, logger: t.context.logger}));
await t.notThrowsAsync(t.context.m.verifyConditions({}, {cwd, env, options, logger: t.context.logger}));
await t.context.m.publish(
{assets},
{cwd, env, options, branch: {type: 'release'}, nextRelease, logger: t.context.logger}
Expand Down Expand Up @@ -419,7 +421,7 @@ test.serial('Verify, update release and notify success', async t => {
)
.reply(200, {items: []});

await t.notThrows(t.context.m.verifyConditions({}, {cwd, env, options, logger: t.context.logger}));
await t.notThrowsAsync(t.context.m.verifyConditions({}, {cwd, env, options, logger: t.context.logger}));
await t.context.m.addChannel(
{},
{cwd, env, branch: {type: 'release'}, currentRelease, nextRelease, options, logger: t.context.logger}
Expand Down Expand Up @@ -463,7 +465,7 @@ test.serial('Verify and notify failure', async t => {
})
.reply(200, {html_url: 'https://github.com/issues/1', number: 1});

await t.notThrows(t.context.m.verifyConditions({}, {cwd, env, options, logger: t.context.logger}));
await t.notThrowsAsync(t.context.m.verifyConditions({}, {cwd, env, options, logger: t.context.logger}));
await t.context.m.fail({failTitle}, {cwd, env, options, branch: {name: 'master'}, errors, logger: t.context.logger});

t.deepEqual(t.context.log.args[0], ['Verify GitHub authentication']);
Expand Down
2 changes: 1 addition & 1 deletion test/publish.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ test.serial('Throw error without retries for 400 error', async t => {
})
.reply(400);

const error = await t.throws(
const error = await t.throwsAsync(
publish(pluginConfig, {cwd, env, options, branch: {type: 'release'}, nextRelease, logger: t.context.logger})
);

Expand Down
2 changes: 1 addition & 1 deletion test/success.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ test.serial('Ignore errors when adding comments and closing issues', async t =>
.patch(`/repos/${owner}/${repo}/issues/3`, {state: 'closed'})
.reply(200, {html_url: 'https://github.com/issues/3'});

const [error1, error2] = await t.throws(
const [error1, error2] = await t.throwsAsync(
success(pluginConfig, {
env,
options,
Expand Down
Loading

0 comments on commit 9bb3dcd

Please sign in to comment.