Skip to content

Commit 50c0d5e

Browse files
greenkeeper[bot]pvdlg
authored andcommitted
test: update ava to version 1.0.1
1 parent 8386664 commit 50c0d5e

File tree

4 files changed

+26
-24
lines changed

4 files changed

+26
-24
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"registry-auth-token": "^3.3.1"
3030
},
3131
"devDependencies": {
32-
"ava": "^0.25.0",
32+
"ava": "^1.0.1",
3333
"clear-module": "^3.0.0",
3434
"codecov": "^3.0.0",
3535
"commitizen": "^3.0.0",

test/get-pkg.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ test('Verify name and version then return parsed package.json from a sub-directo
2727

2828
test('Throw error if missing package.json', async t => {
2929
const cwd = tempy.directory();
30-
const [error] = await t.throws(getPkg({}, {cwd}));
30+
const [error] = await t.throwsAsync(getPkg({}, {cwd}));
3131

3232
t.is(error.name, 'SemanticReleaseError');
3333
t.is(error.code, 'ENOPKG');
@@ -37,7 +37,7 @@ test('Throw error if missing package name', async t => {
3737
const cwd = tempy.directory();
3838
await outputJson(path.resolve(cwd, 'package.json'), {version: '0.0.0'});
3939

40-
const [error] = await t.throws(getPkg({}, {cwd}));
40+
const [error] = await t.throwsAsync(getPkg({}, {cwd}));
4141

4242
t.is(error.name, 'SemanticReleaseError');
4343
t.is(error.code, 'ENOPKGNAME');
@@ -47,7 +47,7 @@ test('Throw error if package.json is malformed', async t => {
4747
const cwd = tempy.directory();
4848
await writeFile(path.resolve(cwd, 'package.json'), "{name: 'package',}");
4949

50-
const [error] = await t.throws(getPkg({}, {cwd}));
50+
const [error] = await t.throwsAsync(getPkg({}, {cwd}));
5151

5252
t.is(error.name, 'JSONError');
5353
});

test/integration.test.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ test('Skip npm auth verification if "npmPublish" is false', async t => {
4747
const pkg = {name: 'published', version: '1.0.0', publishConfig: {registry: npmRegistry.url}};
4848
await outputJson(path.resolve(cwd, 'package.json'), pkg);
4949

50-
await t.notThrows(
50+
await t.notThrowsAsync(
5151
t.context.m.verifyConditions(
5252
{npmPublish: false},
5353
{cwd, env, options: {}, stdout: t.context.stdout, stderr: t.context.stderr, logger: t.context.logger}
@@ -60,7 +60,7 @@ test('Skip npm auth verification if "package.private" is true', async t => {
6060
const pkg = {name: 'published', version: '1.0.0', publishConfig: {registry: npmRegistry.url}, private: true};
6161
await outputJson(path.resolve(cwd, 'package.json'), pkg);
6262

63-
await t.notThrows(
63+
await t.notThrowsAsync(
6464
t.context.m.verifyConditions(
6565
{npmPublish: false},
6666
{
@@ -79,7 +79,7 @@ test('Skip npm token verification if "package.private" is true', async t => {
7979
const cwd = tempy.directory();
8080
const pkg = {name: 'published', version: '1.0.0', publishConfig: {registry: npmRegistry.url}, private: true};
8181
await outputJson(path.resolve(cwd, 'package.json'), pkg);
82-
await t.notThrows(
82+
await t.notThrowsAsync(
8383
t.context.m.verifyConditions(
8484
{},
8585
{
@@ -100,7 +100,7 @@ test('Throws error if NPM token is invalid', async t => {
100100
const pkg = {name: 'published', version: '1.0.0', publishConfig: {registry: npmRegistry.url}};
101101
await outputJson(path.resolve(cwd, 'package.json'), pkg);
102102

103-
const [error] = await t.throws(
103+
const [error] = await t.throwsAsync(
104104
t.context.m.verifyConditions(
105105
{},
106106
{cwd, env, options: {}, stdout: t.context.stdout, stderr: t.context.stderr, logger: t.context.logger}
@@ -120,7 +120,7 @@ test('Skip Token validation if the registry configured is not the default one',
120120
const env = {NPM_TOKEN: 'wrong_token'};
121121
const pkg = {name: 'published', version: '1.0.0', publishConfig: {registry: 'http://custom-registry.com/'}};
122122
await outputJson(path.resolve(cwd, 'package.json'), pkg);
123-
await t.notThrows(
123+
await t.notThrowsAsync(
124124
t.context.m.verifyConditions(
125125
{},
126126
{cwd, env, options: {}, stdout: t.context.stdout, stderr: t.context.stderr, logger: t.context.logger}
@@ -135,7 +135,7 @@ test('Verify npm auth and package', async t => {
135135
const cwd = tempy.directory();
136136
const pkg = {name: 'valid-token', version: '0.0.0-dev', publishConfig: {registry: npmRegistry.url}};
137137
await outputJson(path.resolve(cwd, 'package.json'), pkg);
138-
await t.notThrows(
138+
await t.notThrowsAsync(
139139
t.context.m.verifyConditions(
140140
{},
141141
{
@@ -158,7 +158,7 @@ test('Verify npm auth and package from a sub-directory', async t => {
158158
const cwd = tempy.directory();
159159
const pkg = {name: 'valid-token', version: '0.0.0-dev', publishConfig: {registry: npmRegistry.url}};
160160
await outputJson(path.resolve(cwd, 'dist/package.json'), pkg);
161-
await t.notThrows(
161+
await t.notThrowsAsync(
162162
t.context.m.verifyConditions(
163163
{pkgRoot: 'dist'},
164164
{
@@ -181,7 +181,7 @@ test('Verify npm auth and package with "npm_config_registry" env var set by yarn
181181
const cwd = tempy.directory();
182182
const pkg = {name: 'valid-token', version: '0.0.0-dev', publishConfig: {registry: npmRegistry.url}};
183183
await outputJson(path.resolve(cwd, 'package.json'), pkg);
184-
await t.notThrows(
184+
await t.notThrowsAsync(
185185
t.context.m.verifyConditions(
186186
{},
187187
{
@@ -208,7 +208,7 @@ test('Throw SemanticReleaseError Array if config option are not valid in verifyC
208208
const tarballDir = 42;
209209
const pkgRoot = 42;
210210
const errors = [
211-
...(await t.throws(
211+
...(await t.throwsAsync(
212212
t.context.m.verifyConditions(
213213
{},
214214
{
@@ -332,7 +332,7 @@ test('Create the package and skip publish ("npmPublish" is false)', async t => {
332332
t.false(result);
333333
t.is((await readJson(path.resolve(cwd, 'package.json'))).version, '1.0.0');
334334
t.true(await pathExists(path.resolve(cwd, `tarball/${pkg.name}-1.0.0.tgz`)));
335-
await t.throws(execa('npm', ['view', pkg.name, 'version'], {cwd, env: testEnv}));
335+
await t.throwsAsync(execa('npm', ['view', pkg.name, 'version'], {cwd, env: testEnv}));
336336
});
337337

338338
test('Create the package and skip publish ("package.private" is true)', async t => {
@@ -357,7 +357,7 @@ test('Create the package and skip publish ("package.private" is true)', async t
357357
t.false(result);
358358
t.is((await readJson(path.resolve(cwd, 'package.json'))).version, '1.0.0');
359359
t.true(await pathExists(path.resolve(cwd, `tarball/${pkg.name}-1.0.0.tgz`)));
360-
await t.throws(execa('npm', ['view', pkg.name, 'version'], {cwd, env: testEnv}));
360+
await t.throwsAsync(execa('npm', ['view', pkg.name, 'version'], {cwd, env: testEnv}));
361361
});
362362

363363
test('Create the package and skip publish from a sub-directory ("npmPublish" is false)', async t => {
@@ -382,7 +382,7 @@ test('Create the package and skip publish from a sub-directory ("npmPublish" is
382382
t.false(result);
383383
t.is((await readJson(path.resolve(cwd, 'dist/package.json'))).version, '1.0.0');
384384
t.true(await pathExists(path.resolve(cwd, `tarball/${pkg.name}-1.0.0.tgz`)));
385-
await t.throws(execa('npm', ['view', pkg.name, 'version'], {cwd, env: testEnv}));
385+
await t.throwsAsync(execa('npm', ['view', pkg.name, 'version'], {cwd, env: testEnv}));
386386
});
387387

388388
test('Create the package and skip publish from a sub-directory ("package.private" is true)', async t => {
@@ -412,7 +412,7 @@ test('Create the package and skip publish from a sub-directory ("package.private
412412
t.false(result);
413413
t.is((await readJson(path.resolve(cwd, 'dist/package.json'))).version, '1.0.0');
414414
t.true(await pathExists(path.resolve(cwd, `tarball/${pkg.name}-1.0.0.tgz`)));
415-
await t.throws(execa('npm', ['view', pkg.name, 'version'], {cwd, env: testEnv}));
415+
await t.throwsAsync(execa('npm', ['view', pkg.name, 'version'], {cwd, env: testEnv}));
416416
});
417417

418418
test('Throw SemanticReleaseError Array if config option are not valid in publish', async t => {
@@ -424,7 +424,7 @@ test('Throw SemanticReleaseError Array if config option are not valid in publish
424424
const pkgRoot = 42;
425425

426426
const errors = [
427-
...(await t.throws(
427+
...(await t.throwsAsync(
428428
t.context.m.publish(
429429
{npmPublish, tarballDir, pkgRoot},
430430
{
@@ -505,7 +505,7 @@ test('Throw SemanticReleaseError Array if config option are not valid in prepare
505505
const pkgRoot = 42;
506506

507507
const errors = [
508-
...(await t.throws(
508+
...(await t.throwsAsync(
509509
t.context.m.prepare(
510510
{npmPublish, tarballDir, pkgRoot},
511511
{
@@ -537,7 +537,7 @@ test('Verify token and set up auth only on the fist call, then prepare on prepar
537537
const pkg = {name: 'test-module', version: '0.0.0-dev', publishConfig: {registry: npmRegistry.url}};
538538
await outputJson(path.resolve(cwd, 'package.json'), pkg);
539539

540-
await t.notThrows(
540+
await t.notThrowsAsync(
541541
t.context.m.verifyConditions(
542542
{},
543543
{cwd, env, options: {}, stdout: t.context.stdout, stderr: t.context.stderr, logger: t.context.logger}

test/set-npmrc-auth.test.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ test('Do not modify ".npmrc" if auth is already configured for a scoped package'
6161
test('Throw error if "NPM_TOKEN" is missing', async t => {
6262
const cwd = tempy.directory();
6363

64-
const [error] = await t.throws(setNpmrcAuth('http://custom.registry.com', {cwd, env: {}, logger: t.context.logger}));
64+
const [error] = await t.throwsAsync(
65+
setNpmrcAuth('http://custom.registry.com', {cwd, env: {}, logger: t.context.logger})
66+
);
6567

6668
t.is(error.name, 'SemanticReleaseError');
6769
t.is(error.message, 'No npm token specified.');
@@ -72,7 +74,7 @@ test('Throw error if "NPM_USERNAME" is missing', async t => {
7274
const cwd = tempy.directory();
7375
const env = {NPM_PASSWORD: 'npm_pasword', NPM_EMAIL: 'npm_email'};
7476

75-
const [error] = await t.throws(setNpmrcAuth('http://custom.registry.com', {cwd, env, logger: t.context.logger}));
77+
const [error] = await t.throwsAsync(setNpmrcAuth('http://custom.registry.com', {cwd, env, logger: t.context.logger}));
7678

7779
t.is(error.name, 'SemanticReleaseError');
7880
t.is(error.message, 'No npm token specified.');
@@ -83,7 +85,7 @@ test('Throw error if "NPM_PASSWORD" is missing', async t => {
8385
const cwd = tempy.directory();
8486
const env = {NPM_USERNAME: 'npm_username', NPM_EMAIL: 'npm_email'};
8587

86-
const [error] = await t.throws(setNpmrcAuth('http://custom.registry.com', {cwd, env, logger: t.context.logger}));
88+
const [error] = await t.throwsAsync(setNpmrcAuth('http://custom.registry.com', {cwd, env, logger: t.context.logger}));
8789

8890
t.is(error.name, 'SemanticReleaseError');
8991
t.is(error.message, 'No npm token specified.');
@@ -94,7 +96,7 @@ test('Throw error if "NPM_EMAIL" is missing', async t => {
9496
const cwd = tempy.directory();
9597
const env = {NPM_USERNAME: 'npm_username', NPM_PASSWORD: 'npm_password'};
9698

97-
const [error] = await t.throws(setNpmrcAuth('http://custom.registry.com', {cwd, env, logger: t.context.logger}));
99+
const [error] = await t.throwsAsync(setNpmrcAuth('http://custom.registry.com', {cwd, env, logger: t.context.logger}));
98100

99101
t.is(error.name, 'SemanticReleaseError');
100102
t.is(error.message, 'No npm token specified.');

0 commit comments

Comments
 (0)