Skip to content

Commit

Permalink
chore(package): update ava to version 3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
greenkeeper[bot] authored and pvdlg committed Jan 27, 2020
1 parent bec57cd commit ef1b8a0
Show file tree
Hide file tree
Showing 30 changed files with 255 additions and 232 deletions.
6 changes: 2 additions & 4 deletions package.json
Expand Up @@ -7,9 +7,7 @@
"files": [
"test/**/*.test.js"
],
"helpers": [
"test/helpers/**/*"
]
"timeout": "2m"
},
"bin": {
"semantic-release": "bin/semantic-release.js"
Expand Down Expand Up @@ -52,7 +50,7 @@
"yargs": "^15.0.1"
},
"devDependencies": {
"ava": "^2.0.0",
"ava": "^3.1.0",
"clear-module": "^4.0.0",
"codecov": "^3.0.0",
"delay": "^4.0.0",
Expand Down
10 changes: 5 additions & 5 deletions test/branches/branches.test.js
@@ -1,7 +1,7 @@
import test from 'ava';
import {union} from 'lodash';
import semver from 'semver';
import proxyquire from 'proxyquire';
const test = require('ava');
const {union} = require('lodash');
const semver = require('semver');
const proxyquire = require('proxyquire');

const getBranch = (branches, branch) => branches.find(({name}) => name === branch);
const release = (branches, name, version) => getBranch(branches, name).tags.push({version});
Expand Down Expand Up @@ -135,7 +135,7 @@ test('Enforce ranges with branching release workflow', async t => {
t.is(
getBranch(result, '1.0.x').range,
'>=1.0.1 <1.0.2',
'Cannot release on 1.0.x before 1.0.x version from master are merged'
'Cannot release on 1.0.x before 1.0.x version = require(master are merged'
);
t.is(getBranch(result, '1.x').range, '>=1.1.0 <1.0.2', 'Cannot release on 1.x before >= 2.0.0 is released on master');

Expand Down
6 changes: 3 additions & 3 deletions test/branches/expand.test.js
@@ -1,6 +1,6 @@
import test from 'ava';
import expand from '../../lib/branches/expand';
import {gitRepo, gitCommits, gitCheckout, gitPush} from '../helpers/git-utils';
const test = require('ava');
const expand = require('../../lib/branches/expand');
const {gitRepo, gitCommits, gitCheckout, gitPush} = require('../helpers/git-utils');

test('Expand branches defined with globs', async t => {
const {cwd, repositoryUrl} = await gitRepo(true);
Expand Down
8 changes: 4 additions & 4 deletions test/branches/get-tags.test.js
@@ -1,6 +1,6 @@
import test from 'ava';
import getTags from '../../lib/branches/get-tags';
import {gitRepo, gitCommits, gitTagVersion, gitCheckout, gitAddNote} from '../helpers/git-utils';
const test = require('ava');
const getTags = require('../../lib/branches/get-tags');
const {gitRepo, gitCommits, gitTagVersion, gitCheckout, gitAddNote} = require('../helpers/git-utils');

test('Get the valid tags', async t => {
const {cwd} = await gitRepo();
Expand Down Expand Up @@ -28,7 +28,7 @@ test('Get the valid tags', async t => {
]);
});

test('Get the valid tags from multiple branches', async t => {
test('Get the valid tags = require(multiple branches', async t => {
const {cwd} = await gitRepo();
await gitCommits(['First'], {cwd});
await gitTagVersion('v1.0.0', undefined, {cwd});
Expand Down
4 changes: 2 additions & 2 deletions test/branches/normalize.test.js
@@ -1,5 +1,5 @@
import test from 'ava';
import normalize from '../../lib/branches/normalize';
const test = require('ava');
const normalize = require('../../lib/branches/normalize');

const toTags = versions => versions.map(version => ({version}));

Expand Down
32 changes: 15 additions & 17 deletions test/cli.test.js
@@ -1,10 +1,8 @@
import test from 'ava';
import {escapeRegExp} from 'lodash';
import proxyquire from 'proxyquire';
import {stub} from 'sinon';
import {SECRET_REPLACEMENT} from '../lib/definitions/constants';

const requireNoCache = proxyquire.noPreserveCache();
const test = require('ava');
const {escapeRegExp} = require('lodash');
const proxyquire = require('proxyquire').noPreserveCache();
const {stub} = require('sinon');
const {SECRET_REPLACEMENT} = require('../lib/definitions/constants');

test.beforeEach(t => {
t.context.logs = '';
Expand Down Expand Up @@ -65,7 +63,7 @@ test.serial('Pass options to semantic-release API', async t => {
'--debug',
'-d',
];
const cli = requireNoCache('../cli', {'.': run, process: {...process, argv}});
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});

const exitCode = await cli();

Expand Down Expand Up @@ -107,7 +105,7 @@ test.serial('Pass options to semantic-release API with alias arguments', async t
'config2',
'--dry-run',
];
const cli = requireNoCache('../cli', {'.': run, process: {...process, argv}});
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});

const exitCode = await cli();

Expand All @@ -124,7 +122,7 @@ test.serial('Pass options to semantic-release API with alias arguments', async t
test.serial('Pass unknown options to semantic-release API', async t => {
const run = stub().resolves(true);
const argv = ['', '', '--bool', '--first-option', 'value1', '--second-option', 'value2', '--second-option', 'value3'];
const cli = requireNoCache('../cli', {'.': run, process: {...process, argv}});
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});

const exitCode = await cli();

Expand All @@ -138,7 +136,7 @@ test.serial('Pass unknown options to semantic-release API', async t => {
test.serial('Pass empty Array to semantic-release API for list option set to "false"', async t => {
const run = stub().resolves(true);
const argv = ['', '', '--publish', 'false'];
const cli = requireNoCache('../cli', {'.': run, process: {...process, argv}});
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});

const exitCode = await cli();

Expand All @@ -150,7 +148,7 @@ test.serial('Pass empty Array to semantic-release API for list option set to "fa
test.serial('Do not set properties in option for which arg is not in command line', async t => {
const run = stub().resolves(true);
const argv = ['', '', '-b', 'master'];
const cli = requireNoCache('../cli', {'.': run, process: {...process, argv}});
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});

await cli();

Expand All @@ -167,7 +165,7 @@ test.serial('Do not set properties in option for which arg is not in command lin
test.serial('Display help', async t => {
const run = stub().resolves(true);
const argv = ['', '', '--help'];
const cli = requireNoCache('../cli', {'.': run, process: {...process, argv}});
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});

const exitCode = await cli();

Expand All @@ -178,7 +176,7 @@ test.serial('Display help', async t => {
test.serial('Return error exitCode and prints help if called with a command', async t => {
const run = stub().resolves(true);
const argv = ['', '', 'pre'];
const cli = requireNoCache('../cli', {'.': run, process: {...process, argv}});
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});

const exitCode = await cli();

Expand All @@ -190,7 +188,7 @@ test.serial('Return error exitCode and prints help if called with a command', as
test.serial('Return error exitCode if multiple plugin are set for single plugin', async t => {
const run = stub().resolves(true);
const argv = ['', '', '--analyze-commits', 'analyze1', 'analyze2'];
const cli = requireNoCache('../cli', {'.': run, process: {...process, argv}});
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});

const exitCode = await cli();

Expand All @@ -202,7 +200,7 @@ test.serial('Return error exitCode if multiple plugin are set for single plugin'
test.serial('Return error exitCode if semantic-release throw error', async t => {
const run = stub().rejects(new Error('semantic-release error'));
const argv = ['', ''];
const cli = requireNoCache('../cli', {'.': run, process: {...process, argv}});
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});

const exitCode = await cli();

Expand All @@ -214,7 +212,7 @@ test.serial('Hide sensitive environment variable values from the logs', async t
const env = {MY_TOKEN: 'secret token'};
const run = stub().rejects(new Error(`Throw error: Exposing token ${env.MY_TOKEN}`));
const argv = ['', ''];
const cli = requireNoCache('../cli', {'.': run, process: {...process, argv, env: {...process.env, ...env}}});
const cli = proxyquire('../cli', {'.': run, process: {...process, argv, env: {...process.env, ...env}}});

const exitCode = await cli();

Expand Down
4 changes: 2 additions & 2 deletions test/definitions/branches.test.js
@@ -1,5 +1,5 @@
import test from 'ava';
import {maintenance, prerelease, release} from '../../lib/definitions/branches';
const test = require('ava');
const {maintenance, prerelease, release} = require('../../lib/definitions/branches');

test('A "maintenance" branch is identified by having a "range" property or a "name" formatted like "N.x", "N.x.x" or "N.N.x"', t => {
t.true(maintenance.filter({name: '1.x.x'}));
Expand Down
6 changes: 3 additions & 3 deletions test/definitions/plugins.test.js
@@ -1,6 +1,6 @@
import test from 'ava';
import plugins from '../../lib/definitions/plugins';
import {RELEASE_NOTES_SEPARATOR, SECRET_REPLACEMENT} from '../../lib/definitions/constants';
const test = require('ava');
const plugins = require('../../lib/definitions/plugins');
const {RELEASE_NOTES_SEPARATOR, SECRET_REPLACEMENT} = require('../../lib/definitions/constants');

test('The "analyzeCommits" plugin output must be either undefined or a valid semver release type', t => {
t.false(plugins.analyzeCommits.outputValidator('invalid'));
Expand Down
8 changes: 4 additions & 4 deletions test/get-commits.test.js
@@ -1,7 +1,7 @@
import test from 'ava';
import {stub} from 'sinon';
import getCommits from '../lib/get-commits';
import {gitRepo, gitCommits, gitDetachedHead} from './helpers/git-utils';
const test = require('ava');
const {stub} = require('sinon');
const getCommits = require('../lib/get-commits');
const {gitRepo, gitCommits, gitDetachedHead} = require('./helpers/git-utils');

test.beforeEach(t => {
// Stub the logger functions
Expand Down

0 comments on commit ef1b8a0

Please sign in to comment.