Skip to content

Commit 3c1eb83

Browse files
greenkeeper[bot]pvdlg
authored andcommitted
chore(package): update ava to version 3.0.0
1 parent e38f98d commit 3c1eb83

File tree

6 files changed

+57
-44
lines changed

6 files changed

+57
-44
lines changed

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
"ava": {
77
"files": [
88
"test/**/*.test.js"
9-
],
10-
"helpers": [
11-
"test/helpers/**/*"
129
]
1310
},
1411
"bugs": {
@@ -29,7 +26,7 @@
2926
"p-reduce": "^2.0.0"
3027
},
3128
"devDependencies": {
32-
"ava": "^2.0.0",
29+
"ava": "^3.1.0",
3330
"clear-module": "^4.0.0",
3431
"codecov": "^3.0.0",
3532
"file-url": "^3.0.0",

test/git.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import path from 'path';
2-
import test from 'ava';
3-
import {outputFile, appendFile} from 'fs-extra';
4-
import {add, getModifiedFiles, commit, gitHead, push} from '../lib/git';
5-
import {gitRepo, gitCommits, gitGetCommits, gitStaged, gitRemoteHead} from './helpers/git-utils';
1+
const path = require('path');
2+
const test = require('ava');
3+
const {outputFile, appendFile} = require('fs-extra');
4+
const {add, getModifiedFiles, commit, gitHead, push} = require('../lib/git');
5+
const {gitRepo, gitCommits, gitGetCommits, gitStaged, gitRemoteHead} = require('./helpers/git-utils');
66

77
test('Add file to index', async t => {
88
// Create a git repository, set the current working directory at the root of the repo

test/helpers/git-utils.js

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import tempy from 'tempy';
2-
import execa from 'execa';
3-
import fileUrl from 'file-url';
4-
import pReduce from 'p-reduce';
5-
import gitLogParser from 'git-log-parser';
6-
import getStream from 'get-stream';
1+
const tempy = require('tempy');
2+
const execa = require('execa');
3+
const fileUrl = require('file-url');
4+
const pReduce = require('p-reduce');
5+
const gitLogParser = require('git-log-parser');
6+
const getStream = require('get-stream');
77

88
/**
99
* Create a temporary git repository.
@@ -14,7 +14,7 @@ import getStream from 'get-stream';
1414
* @param {String} [branch='master'] The branch to initialize.
1515
* @return {String} The path of the clone if `withRemote` is `true`, the path of the repository otherwise.
1616
*/
17-
export async function gitRepo(withRemote, branch = 'master') {
17+
async function gitRepo(withRemote, branch = 'master') {
1818
let cwd = tempy.directory();
1919

2020
await execa('git', ['init'].concat(withRemote ? ['--bare'] : []), {cwd});
@@ -43,7 +43,7 @@ export async function gitRepo(withRemote, branch = 'master') {
4343
* @param {String} repositoryUrl The URL of the bare repository.
4444
* @param {String} [branch='master'] the branch to initialize.
4545
*/
46-
export async function initBareRepo(repositoryUrl, branch = 'master') {
46+
async function initBareRepo(repositoryUrl, branch = 'master') {
4747
const cwd = tempy.directory();
4848
await execa('git', ['clone', '--no-hardlinks', repositoryUrl, cwd], {cwd});
4949
await gitCheckout(branch, true, {cwd});
@@ -59,7 +59,7 @@ export async function initBareRepo(repositoryUrl, branch = 'master') {
5959
*
6060
* @returns {Array<Commit>} The created commits, in reverse order (to match `git log` order).
6161
*/
62-
export async function gitCommits(messages, execaOpts) {
62+
async function gitCommits(messages, execaOpts) {
6363
await pReduce(
6464
messages,
6565
async (_, message) =>
@@ -76,7 +76,7 @@ export async function gitCommits(messages, execaOpts) {
7676
*
7777
* @return {Array<Object>} The list of parsed commits.
7878
*/
79-
export async function gitGetCommits(from, execaOpts) {
79+
async function gitGetCommits(from, execaOpts) {
8080
Object.assign(gitLogParser.fields, {hash: 'H', message: 'B', gitTags: 'd', committerDate: {key: 'ci', type: Date}});
8181
return (
8282
await getStream.array(
@@ -96,7 +96,7 @@ export async function gitGetCommits(from, execaOpts) {
9696
* @param {Boolean} create to create the branch, `false` to checkout an existing branch.
9797
* @param {Object} [execaOpts] Options to pass to `execa`.
9898
*/
99-
export async function gitCheckout(branch, create, execaOpts) {
99+
async function gitCheckout(branch, create, execaOpts) {
100100
await execa('git', create ? ['checkout', '-b', branch] : ['checkout', branch], execaOpts);
101101
}
102102

@@ -107,7 +107,7 @@ export async function gitCheckout(branch, create, execaOpts) {
107107
* @param {String} [sha] The commit on which to create the tag. If undefined the tag is created on the last commit.
108108
* @param {Object} [execaOpts] Options to pass to `execa`.
109109
*/
110-
export async function gitTagVersion(tagName, sha, execaOpts) {
110+
async function gitTagVersion(tagName, sha, execaOpts) {
111111
await execa('git', sha ? ['tag', '-f', tagName, sha] : ['tag', tagName], execaOpts);
112112
}
113113

@@ -120,7 +120,7 @@ export async function gitTagVersion(tagName, sha, execaOpts) {
120120
* @param {Number} [depth=1] The number of commit to clone.
121121
* @return {String} The path of the cloned repository.
122122
*/
123-
export async function gitShallowClone(repositoryUrl, branch = 'master', depth = 1) {
123+
async function gitShallowClone(repositoryUrl, branch = 'master', depth = 1) {
124124
const cwd = tempy.directory();
125125

126126
await execa('git', ['clone', '--no-hardlinks', '--no-tags', '-b', branch, '--depth', depth, repositoryUrl, cwd], {
@@ -136,7 +136,7 @@ export async function gitShallowClone(repositoryUrl, branch = 'master', depth =
136136
* @param {Number} head A commit sha of the remote repo that will become the detached head of the new one.
137137
* @return {String} The path of the new repository.
138138
*/
139-
export async function gitDetachedHead(repositoryUrl, head) {
139+
async function gitDetachedHead(repositoryUrl, head) {
140140
const cwd = tempy.directory();
141141

142142
await execa('git', ['init'], {cwd});
@@ -154,7 +154,7 @@ export async function gitDetachedHead(repositoryUrl, head) {
154154
*
155155
* @return {String} The HEAD sha of the remote repository.
156156
*/
157-
export async function gitRemoteHead(repositoryUrl, execaOpts) {
157+
async function gitRemoteHead(repositoryUrl, execaOpts) {
158158
return (await execa('git', ['ls-remote', repositoryUrl, 'HEAD'], execaOpts)).stdout
159159
.split('\n')
160160
.filter(head => Boolean(head))
@@ -168,7 +168,7 @@ export async function gitRemoteHead(repositoryUrl, execaOpts) {
168168
*
169169
* @return {Array<String>} Array of staged files path.
170170
*/
171-
export async function gitStaged(execaOpts) {
171+
async function gitStaged(execaOpts) {
172172
return (await execa('git', ['status', '--porcelain'], execaOpts)).stdout
173173
.split('\n')
174174
.filter(status => status.startsWith('A '))
@@ -183,7 +183,7 @@ export async function gitStaged(execaOpts) {
183183
*
184184
* @return {Array<String>} The list of files path included in the commit.
185185
*/
186-
export async function gitCommitedFiles(ref, execaOpts) {
186+
async function gitCommitedFiles(ref, execaOpts) {
187187
return (await execa('git', ['diff-tree', '-r', '--name-only', '--no-commit-id', '-r', ref], execaOpts)).stdout
188188
.split('\n')
189189
.filter(file => Boolean(file));
@@ -195,7 +195,7 @@ export async function gitCommitedFiles(ref, execaOpts) {
195195
* @param {Array<String>} files Array of files path to add to the index.
196196
* @param {Object} [execaOpts] Options to pass to `execa`.
197197
*/
198-
export async function gitAdd(files, execaOpts) {
198+
async function gitAdd(files, execaOpts) {
199199
await execa('git', ['add', '--force', '--ignore-errors', ...files], {...execaOpts});
200200
}
201201

@@ -206,6 +206,22 @@ export async function gitAdd(files, execaOpts) {
206206
* @param {String} branch The branch to push.
207207
* @param {Object} [execaOpts] Options to pass to `execa`.
208208
*/
209-
export async function gitPush(repositoryUrl, branch, execaOpts) {
209+
async function gitPush(repositoryUrl, branch, execaOpts) {
210210
await execa('git', ['push', '--tags', repositoryUrl, `HEAD:${branch}`], execaOpts);
211211
}
212+
213+
module.exports = {
214+
gitRepo,
215+
initBareRepo,
216+
gitCommits,
217+
gitGetCommits,
218+
gitCheckout,
219+
gitTagVersion,
220+
gitShallowClone,
221+
gitDetachedHead,
222+
gitRemoteHead,
223+
gitStaged,
224+
gitCommitedFiles,
225+
gitAdd,
226+
gitPush,
227+
};

test/integration.test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import path from 'path';
2-
import test from 'ava';
3-
import {outputFile} from 'fs-extra';
4-
import {stub} from 'sinon';
5-
import clearModule from 'clear-module';
6-
import {push, add} from '../lib/git';
7-
import {
1+
const path = require('path');
2+
const test = require('ava');
3+
const {outputFile} = require('fs-extra');
4+
const {stub} = require('sinon');
5+
const clearModule = require('clear-module');
6+
const {push, add} = require('../lib/git');
7+
const {
88
gitRepo,
99
gitCommits,
1010
gitShallowClone,
1111
gitDetachedHead,
1212
gitCommitedFiles,
1313
gitGetCommits,
1414
gitTagVersion,
15-
} from './helpers/git-utils';
15+
} = require('./helpers/git-utils');
1616

1717
test.beforeEach(t => {
1818
// Clear npm cache to refresh the module state

test/prepare.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import path from 'path';
2-
import test from 'ava';
3-
import {outputFile, remove} from 'fs-extra';
4-
import {stub} from 'sinon';
5-
import prepare from '../lib/prepare';
6-
import {gitRepo, gitGetCommits, gitCommitedFiles, gitAdd, gitCommits, gitPush} from './helpers/git-utils';
1+
const path = require('path');
2+
const test = require('ava');
3+
const {outputFile, remove} = require('fs-extra');
4+
const {stub} = require('sinon');
5+
const prepare = require('../lib/prepare');
6+
const {gitRepo, gitGetCommits, gitCommitedFiles, gitAdd, gitCommits, gitPush} = require('./helpers/git-utils');
77

88
test.beforeEach(t => {
99
// Stub the logger functions

test/verify.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import test from 'ava';
2-
import verify from '../lib/verify';
1+
const test = require('ava');
2+
const verify = require('../lib/verify');
33

44
test('Throw SemanticReleaseError if "assets" option is not a String or false or an Array of Objects', t => {
55
const assets = true;

0 commit comments

Comments
 (0)