Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
687435b9a2 | ||
|
|
7e785fa757 | ||
|
|
053c9edf9b | ||
|
|
2edd9da598 | ||
|
|
cbf57851fb |
+4
-12
@@ -42,26 +42,18 @@ module.exports = async (opts, logger) => {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const repositoryUrl = (await pkgRepoUrl()) || (await repoUrl());
|
||||||
|
|
||||||
// Set default options values if not defined yet
|
// Set default options values if not defined yet
|
||||||
options = {
|
options = {
|
||||||
branch: 'master',
|
branch: 'master',
|
||||||
repositoryUrl: (await pkgRepoUrl()) || (await repoUrl()),
|
repositoryUrl: repositoryUrl ? getGitAuthUrl(repositoryUrl) : repositoryUrl,
|
||||||
tagFormat: `v\${version}`,
|
tagFormat: `v\${version}`,
|
||||||
// Remove `null` and `undefined` options so they can be replaced with default ones
|
// Remove `null` and `undefined` options so they can be replaced with default ones
|
||||||
...pickBy(options, option => !isUndefined(option) && !isNull(option)),
|
...pickBy(options, option => !isUndefined(option) && !isNull(option)),
|
||||||
};
|
};
|
||||||
|
|
||||||
debug('options values: %O', Object.keys(options));
|
debug('options values: %O', options);
|
||||||
debug('name: %O', options.name);
|
|
||||||
debug('branch: %O', options.branch);
|
|
||||||
debug('repositoryUrl: %O', options.repositoryUrl);
|
|
||||||
debug('analyzeCommits: %O', options.analyzeCommits);
|
|
||||||
debug('generateNotes: %O', options.generateNotes);
|
|
||||||
debug('verifyConditions: %O', options.verifyConditions);
|
|
||||||
debug('verifyRelease: %O', options.verifyRelease);
|
|
||||||
debug('publish: %O', options.publish);
|
|
||||||
|
|
||||||
options.repositoryUrl = options.repositoryUrl ? getGitAuthUrl(options.repositoryUrl) : options.repositoryUrl;
|
|
||||||
|
|
||||||
return {options, plugins: await plugins(options, pluginsPath, logger)};
|
return {options, plugins: await plugins(options, pluginsPath, logger)};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,11 +19,12 @@ module.exports = repositoryUrl => {
|
|||||||
? `gitlab-ci-token:${process.env[envVar]}`
|
? `gitlab-ci-token:${process.env[envVar]}`
|
||||||
: process.env[envVar];
|
: process.env[envVar];
|
||||||
|
|
||||||
if (!gitCredentials) {
|
|
||||||
return repositoryUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
const {protocols} = gitUrlParse(repositoryUrl);
|
const {protocols} = gitUrlParse(repositoryUrl);
|
||||||
const protocol = protocols.includes('https') ? 'https' : protocols.includes('http') ? 'http' : 'https';
|
const protocol = protocols.includes('https') ? 'https' : protocols.includes('http') ? 'http' : 'https';
|
||||||
|
|
||||||
|
if (!gitCredentials) {
|
||||||
|
return protocols.includes('https') ? `${gitUrlParse(repositoryUrl).toString(protocol)}.git` : repositoryUrl;
|
||||||
|
}
|
||||||
|
|
||||||
return format({...parse(`${gitUrlParse(repositoryUrl).toString(protocol)}.git`), ...{auth: gitCredentials}});
|
return format({...parse(`${gitUrlParse(repositoryUrl).toString(protocol)}.git`), ...{auth: gitCredentials}});
|
||||||
};
|
};
|
||||||
|
|||||||
+34
-10
@@ -9,7 +9,11 @@ const debug = require('debug')('semantic-release:get-version-head');
|
|||||||
* @return {string} The commit sha of the tag in parameter or `null`.
|
* @return {string} The commit sha of the tag in parameter or `null`.
|
||||||
*/
|
*/
|
||||||
async function gitTagHead(tagName) {
|
async function gitTagHead(tagName) {
|
||||||
return execa.stdout('git', ['rev-list', '-1', tagName], {reject: false});
|
try {
|
||||||
|
return await execa.stdout('git', ['rev-list', '-1', tagName]);
|
||||||
|
} catch (err) {
|
||||||
|
debug(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,10 +32,14 @@ async function gitTags() {
|
|||||||
*
|
*
|
||||||
* @param {string} ref The reference to look for.
|
* @param {string} ref The reference to look for.
|
||||||
*
|
*
|
||||||
* @return {boolean} `true` if the reference is in the history of the current branch, `false` otherwise.
|
* @return {boolean} `true` if the reference is in the history of the current branch, falsy otherwise.
|
||||||
*/
|
*/
|
||||||
async function isRefInHistory(ref) {
|
async function isRefInHistory(ref) {
|
||||||
return (await execa('git', ['merge-base', '--is-ancestor', ref, 'HEAD'], {reject: false})).code === 0;
|
try {
|
||||||
|
return (await execa('git', ['merge-base', '--is-ancestor', ref, 'HEAD'])).code === 0;
|
||||||
|
} catch (err) {
|
||||||
|
debug(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,14 +60,22 @@ async function gitHead() {
|
|||||||
* @return {string} The value of the remote git URL.
|
* @return {string} The value of the remote git URL.
|
||||||
*/
|
*/
|
||||||
async function repoUrl() {
|
async function repoUrl() {
|
||||||
return execa.stdout('git', ['remote', 'get-url', 'origin'], {reject: false});
|
try {
|
||||||
|
return await execa.stdout('git', ['remote', 'get-url', 'origin']);
|
||||||
|
} catch (err) {
|
||||||
|
debug(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {Boolean} `true` if the current working directory is in a git repository, `false` otherwise.
|
* @return {Boolean} `true` if the current working directory is in a git repository, falsy otherwise.
|
||||||
*/
|
*/
|
||||||
async function isGitRepo() {
|
async function isGitRepo() {
|
||||||
return (await execa('git', ['rev-parse', '--git-dir'], {reject: false})).code === 0;
|
try {
|
||||||
|
return (await execa('git', ['rev-parse', '--git-dir'])).code === 0;
|
||||||
|
} catch (err) {
|
||||||
|
debug(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,10 +84,14 @@ async function isGitRepo() {
|
|||||||
* @param {String} origin The remote repository URL.
|
* @param {String} origin The remote repository URL.
|
||||||
* @param {String} branch The repositoru branch for which to verify write access.
|
* @param {String} branch The repositoru branch for which to verify write access.
|
||||||
*
|
*
|
||||||
* @return {Boolean} `true` is authorized to push, `false` otherwise.
|
* @return {Boolean} `true` is authorized to push, falsy otherwise.
|
||||||
*/
|
*/
|
||||||
async function verifyAuth(origin, branch) {
|
async function verifyAuth(origin, branch) {
|
||||||
return (await execa('git', ['push', '--dry-run', origin, `HEAD:${branch}`], {reject: false})).code === 0;
|
try {
|
||||||
|
return (await execa('git', ['push', '--dry-run', origin, `HEAD:${branch}`])).code === 0;
|
||||||
|
} catch (err) {
|
||||||
|
debug(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -117,10 +137,14 @@ async function deleteTag(origin, tagName) {
|
|||||||
*
|
*
|
||||||
* @method verifyTagName
|
* @method verifyTagName
|
||||||
* @param {string} tagName the tag name to verify.
|
* @param {string} tagName the tag name to verify.
|
||||||
* @return {boolean} `true` if valid, `false` otherwise.
|
* @return {boolean} `true` if valid, falsy otherwise.
|
||||||
*/
|
*/
|
||||||
async function verifyTagName(tagName) {
|
async function verifyTagName(tagName) {
|
||||||
return (await execa('git', ['check-ref-format', `refs/tags/${tagName}`], {reject: false})).code === 0;
|
try {
|
||||||
|
return (await execa('git', ['check-ref-format', `refs/tags/${tagName}`])).code === 0;
|
||||||
|
} catch (err) {
|
||||||
|
debug(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@
|
|||||||
"execa": "^0.9.0",
|
"execa": "^0.9.0",
|
||||||
"get-stream": "^3.0.0",
|
"get-stream": "^3.0.0",
|
||||||
"git-log-parser": "^1.2.0",
|
"git-log-parser": "^1.2.0",
|
||||||
"git-url-parse": "^8.0.0",
|
"git-url-parse": "^8.1.0",
|
||||||
"hook-std": "^0.4.0",
|
"hook-std": "^0.4.0",
|
||||||
"lodash": "^4.17.4",
|
"lodash": "^4.17.4",
|
||||||
"marked": "^0.3.9",
|
"marked": "^0.3.9",
|
||||||
|
|||||||
+14
-14
@@ -63,7 +63,7 @@ test.serial('Default values, reading repositoryUrl from repo if not set in packa
|
|||||||
});
|
});
|
||||||
|
|
||||||
test.serial('Default values, reading repositoryUrl (http url) from package.json if not set in repo', async t => {
|
test.serial('Default values, reading repositoryUrl (http url) from package.json if not set in repo', async t => {
|
||||||
const pkg = {repository: 'git+https://hostname.com/owner/module.git'};
|
const pkg = {repository: 'https://hostname.com/owner/module.git'};
|
||||||
// Create a git repository, set the current working directory at the root of the repo
|
// Create a git repository, set the current working directory at the root of the repo
|
||||||
await gitRepo();
|
await gitRepo();
|
||||||
// Create package.json in repository root
|
// Create package.json in repository root
|
||||||
@@ -82,7 +82,7 @@ test.serial('Read options from package.json', async t => {
|
|||||||
analyzeCommits: {path: 'analyzeCommits', param: 'analyzeCommits_param'},
|
analyzeCommits: {path: 'analyzeCommits', param: 'analyzeCommits_param'},
|
||||||
generateNotes: 'generateNotes',
|
generateNotes: 'generateNotes',
|
||||||
branch: 'test_branch',
|
branch: 'test_branch',
|
||||||
repositoryUrl: 'git+https://hostname.com/owner/module.git',
|
repositoryUrl: 'https://hostname.com/owner/module.git',
|
||||||
tagFormat: `v\${version}`,
|
tagFormat: `v\${version}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ test.serial('Read options from .releaserc.yml', async t => {
|
|||||||
const release = {
|
const release = {
|
||||||
analyzeCommits: {path: 'analyzeCommits', param: 'analyzeCommits_param'},
|
analyzeCommits: {path: 'analyzeCommits', param: 'analyzeCommits_param'},
|
||||||
branch: 'test_branch',
|
branch: 'test_branch',
|
||||||
repositoryUrl: 'git+https://hostname.com/owner/module.git',
|
repositoryUrl: 'https://hostname.com/owner/module.git',
|
||||||
tagFormat: `v\${version}`,
|
tagFormat: `v\${version}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ test.serial('Read options from .releaserc.json', async t => {
|
|||||||
const release = {
|
const release = {
|
||||||
analyzeCommits: {path: 'analyzeCommits', param: 'analyzeCommits_param'},
|
analyzeCommits: {path: 'analyzeCommits', param: 'analyzeCommits_param'},
|
||||||
branch: 'test_branch',
|
branch: 'test_branch',
|
||||||
repositoryUrl: 'git+https://hostname.com/owner/module.git',
|
repositoryUrl: 'https://hostname.com/owner/module.git',
|
||||||
tagFormat: `v\${version}`,
|
tagFormat: `v\${version}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ test.serial('Read options from .releaserc.js', async t => {
|
|||||||
const release = {
|
const release = {
|
||||||
analyzeCommits: {path: 'analyzeCommits', param: 'analyzeCommits_param'},
|
analyzeCommits: {path: 'analyzeCommits', param: 'analyzeCommits_param'},
|
||||||
branch: 'test_branch',
|
branch: 'test_branch',
|
||||||
repositoryUrl: 'git+https://hostname.com/owner/module.git',
|
repositoryUrl: 'https://hostname.com/owner/module.git',
|
||||||
tagFormat: `v\${version}`,
|
tagFormat: `v\${version}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -166,7 +166,7 @@ test.serial('Read options from release.config.js', async t => {
|
|||||||
const release = {
|
const release = {
|
||||||
analyzeCommits: {path: 'analyzeCommits', param: 'analyzeCommits_param'},
|
analyzeCommits: {path: 'analyzeCommits', param: 'analyzeCommits_param'},
|
||||||
branch: 'test_branch',
|
branch: 'test_branch',
|
||||||
repositoryUrl: 'git+https://hostname.com/owner/module.git',
|
repositoryUrl: 'https://hostname.com/owner/module.git',
|
||||||
tagFormat: `v\${version}`,
|
tagFormat: `v\${version}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -217,7 +217,7 @@ test.serial('Read configuration from file path in "extends"', async t => {
|
|||||||
analyzeCommits: {path: 'analyzeCommits', param: 'analyzeCommits_param'},
|
analyzeCommits: {path: 'analyzeCommits', param: 'analyzeCommits_param'},
|
||||||
generateNotes: 'generateNotes',
|
generateNotes: 'generateNotes',
|
||||||
branch: 'test_branch',
|
branch: 'test_branch',
|
||||||
repositoryUrl: 'git+https://hostname.com/owner/module.git',
|
repositoryUrl: 'https://hostname.com/owner/module.git',
|
||||||
tagFormat: `v\${version}`,
|
tagFormat: `v\${version}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -245,7 +245,7 @@ test.serial('Read configuration from module path in "extends"', async t => {
|
|||||||
analyzeCommits: {path: 'analyzeCommits', param: 'analyzeCommits_param'},
|
analyzeCommits: {path: 'analyzeCommits', param: 'analyzeCommits_param'},
|
||||||
generateNotes: 'generateNotes',
|
generateNotes: 'generateNotes',
|
||||||
branch: 'test_branch',
|
branch: 'test_branch',
|
||||||
repositoryUrl: 'git+https://hostname.com/owner/module.git',
|
repositoryUrl: 'https://hostname.com/owner/module.git',
|
||||||
tagFormat: `v\${version}`,
|
tagFormat: `v\${version}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -273,7 +273,7 @@ test.serial('Read configuration from an array of paths in "extends"', async t =>
|
|||||||
verifyRelease: 'verifyRelease1',
|
verifyRelease: 'verifyRelease1',
|
||||||
analyzeCommits: {path: 'analyzeCommits1', param: 'analyzeCommits_param1'},
|
analyzeCommits: {path: 'analyzeCommits1', param: 'analyzeCommits_param1'},
|
||||||
branch: 'test_branch',
|
branch: 'test_branch',
|
||||||
repositoryUrl: 'git+https://hostname.com/owner/module.git',
|
repositoryUrl: 'https://hostname.com/owner/module.git',
|
||||||
};
|
};
|
||||||
|
|
||||||
const shareable2 = {
|
const shareable2 = {
|
||||||
@@ -318,7 +318,7 @@ test.serial('Prioritize configuration from config file over "extends"', async t
|
|||||||
generateNotes: 'generateNotesShareable',
|
generateNotes: 'generateNotesShareable',
|
||||||
publish: [{path: 'publishShareable', param: 'publishShareable_param'}],
|
publish: [{path: 'publishShareable', param: 'publishShareable_param'}],
|
||||||
branch: 'test_branch',
|
branch: 'test_branch',
|
||||||
repositoryUrl: 'git+https://hostname.com/owner/module.git',
|
repositoryUrl: 'https://hostname.com/owner/module.git',
|
||||||
tagFormat: `v\${version}`,
|
tagFormat: `v\${version}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -346,7 +346,7 @@ test.serial('Prioritize configuration from cli/API options over "extends"', asyn
|
|||||||
extends: './shareable2.json',
|
extends: './shareable2.json',
|
||||||
branch: 'branch_opts',
|
branch: 'branch_opts',
|
||||||
publish: [{path: 'publishOpts', param: 'publishOpts_param'}],
|
publish: [{path: 'publishOpts', param: 'publishOpts_param'}],
|
||||||
repositoryUrl: 'git+https://hostname.com/owner/module.git',
|
repositoryUrl: 'https://hostname.com/owner/module.git',
|
||||||
};
|
};
|
||||||
const release = {
|
const release = {
|
||||||
extends: './shareable1.json',
|
extends: './shareable1.json',
|
||||||
@@ -359,7 +359,7 @@ test.serial('Prioritize configuration from cli/API options over "extends"', asyn
|
|||||||
generateNotes: 'generateNotesShareable1',
|
generateNotes: 'generateNotesShareable1',
|
||||||
publish: [{path: 'publishShareable', param: 'publishShareable_param1'}],
|
publish: [{path: 'publishShareable', param: 'publishShareable_param1'}],
|
||||||
branch: 'test_branch1',
|
branch: 'test_branch1',
|
||||||
repositoryUrl: 'git+https://hostname.com/owner/module.git',
|
repositoryUrl: 'https://hostname.com/owner/module.git',
|
||||||
};
|
};
|
||||||
const shareable2 = {
|
const shareable2 = {
|
||||||
analyzeCommits: 'analyzeCommits2',
|
analyzeCommits: 'analyzeCommits2',
|
||||||
@@ -388,7 +388,7 @@ test.serial('Allow to unset properties defined in shareable config with "null"',
|
|||||||
extends: './shareable.json',
|
extends: './shareable.json',
|
||||||
analyzeCommits: null,
|
analyzeCommits: null,
|
||||||
branch: 'test_branch',
|
branch: 'test_branch',
|
||||||
repositoryUrl: 'git+https://hostname.com/owner/module.git',
|
repositoryUrl: 'https://hostname.com/owner/module.git',
|
||||||
};
|
};
|
||||||
const shareable = {
|
const shareable = {
|
||||||
generateNotes: 'generateNotes',
|
generateNotes: 'generateNotes',
|
||||||
@@ -422,7 +422,7 @@ test.serial('Allow to unset properties defined in shareable config with "undefin
|
|||||||
extends: './shareable.json',
|
extends: './shareable.json',
|
||||||
analyzeCommits: undefined,
|
analyzeCommits: undefined,
|
||||||
branch: 'test_branch',
|
branch: 'test_branch',
|
||||||
repositoryUrl: 'git+https://hostname.com/owner/module.git',
|
repositoryUrl: 'https://hostname.com/owner/module.git',
|
||||||
};
|
};
|
||||||
const shareable = {
|
const shareable = {
|
||||||
generateNotes: 'generateNotes',
|
generateNotes: 'generateNotes',
|
||||||
|
|||||||
@@ -14,10 +14,29 @@ test.afterEach.always(() => {
|
|||||||
process.env = envBackup;
|
process.env = envBackup;
|
||||||
});
|
});
|
||||||
|
|
||||||
test.serial('Return the same "repositoryUrl" is no "gitCredentials" is defined', t => {
|
test.serial('Return the same "git" formatted URL if "gitCredentials" is not defined', t => {
|
||||||
t.is(getAuthUrl('git@host.com:owner/repo.git'), 'git@host.com:owner/repo.git');
|
t.is(getAuthUrl('git@host.com:owner/repo.git'), 'git@host.com:owner/repo.git');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test.serial('Return the same "https" formatted URL if "gitCredentials" is not defined', t => {
|
||||||
|
t.is(getAuthUrl('https://host.com/owner/repo.git'), 'https://host.com/owner/repo.git');
|
||||||
|
});
|
||||||
|
|
||||||
|
test.serial(
|
||||||
|
'Return the "https" formatted URL if "gitCredentials" is not defined and repositoryUrl is a "git+https" URL',
|
||||||
|
t => {
|
||||||
|
t.is(getAuthUrl('git+https://host.com/owner/repo.git'), 'https://host.com/owner/repo.git');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
test.serial('Handle "https" URL with group and subgroup', t => {
|
||||||
|
t.is(getAuthUrl('https://host.com/group/subgroup/owner/repo.git'), 'https://host.com/group/subgroup/owner/repo.git');
|
||||||
|
});
|
||||||
|
|
||||||
|
test.serial('Handle "git" URL with group and subgroup', t => {
|
||||||
|
t.is(getAuthUrl('git@host.com:group/subgroup/owner/repo.git'), 'git@host.com:group/subgroup/owner/repo.git');
|
||||||
|
});
|
||||||
|
|
||||||
test.serial('Return the "https" formatted URL if "gitCredentials" is defined and repositoryUrl is a "git" URL', t => {
|
test.serial('Return the "https" formatted URL if "gitCredentials" is defined and repositoryUrl is a "git" URL', t => {
|
||||||
process.env.GIT_CREDENTIALS = 'user:pass';
|
process.env.GIT_CREDENTIALS = 'user:pass';
|
||||||
t.is(getAuthUrl('git@host.com:owner/repo.git'), 'https://user:pass@host.com/owner/repo.git');
|
t.is(getAuthUrl('git@host.com:owner/repo.git'), 'https://user:pass@host.com/owner/repo.git');
|
||||||
@@ -68,3 +87,19 @@ test.serial('Return the "https" formatted URL if "gitCredentials" is defined wit
|
|||||||
process.env.GITLAB_TOKEN = 'token';
|
process.env.GITLAB_TOKEN = 'token';
|
||||||
t.is(getAuthUrl('git@host.com:owner/repo.git'), 'https://gitlab-ci-token:token@host.com/owner/repo.git');
|
t.is(getAuthUrl('git@host.com:owner/repo.git'), 'https://gitlab-ci-token:token@host.com/owner/repo.git');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test.serial('Handle "https" URL with group and subgroup, with "GIT_CREDENTIALS"', t => {
|
||||||
|
process.env.GIT_CREDENTIALS = 'user:pass';
|
||||||
|
t.is(
|
||||||
|
getAuthUrl('https://host.com/group/subgroup/owner/repo.git'),
|
||||||
|
'https://user:pass@host.com/group/subgroup/owner/repo.git'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test.serial('Handle "git" URL with group and subgroup, with "GIT_CREDENTIALS', t => {
|
||||||
|
process.env.GIT_CREDENTIALS = 'user:pass';
|
||||||
|
t.is(
|
||||||
|
getAuthUrl('git@host.com:group/subgroup/owner/repo.git'),
|
||||||
|
'https://user:pass@host.com/group/subgroup/owner/repo.git'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|||||||
+8
-8
@@ -88,7 +88,7 @@ test.serial('Verify if the commit `sha` is in the direct history of the current
|
|||||||
await gitCheckout('master', false);
|
await gitCheckout('master', false);
|
||||||
|
|
||||||
t.true(await isRefInHistory(commits[0].hash));
|
t.true(await isRefInHistory(commits[0].hash));
|
||||||
t.false(await isRefInHistory(otherCommits[0].hash));
|
t.falsy(await isRefInHistory(otherCommits[0].hash));
|
||||||
});
|
});
|
||||||
|
|
||||||
test.serial('Get the commit sha for a given tag or falsy if the tag does not exists', async t => {
|
test.serial('Get the commit sha for a given tag or falsy if the tag does not exists', async t => {
|
||||||
@@ -169,11 +169,11 @@ test.serial('Return "true" if in a Git repository', async t => {
|
|||||||
t.true(await isGitRepo());
|
t.true(await isGitRepo());
|
||||||
});
|
});
|
||||||
|
|
||||||
test.serial('Return "false" if not in a Git repository', async t => {
|
test.serial('Return falsy if not in a Git repository', async t => {
|
||||||
const dir = tempy.directory();
|
const dir = tempy.directory();
|
||||||
process.chdir(dir);
|
process.chdir(dir);
|
||||||
|
|
||||||
t.false(await isGitRepo());
|
t.falsy(await isGitRepo());
|
||||||
});
|
});
|
||||||
|
|
||||||
test.serial('Return "true" for valid tag names', async t => {
|
test.serial('Return "true" for valid tag names', async t => {
|
||||||
@@ -183,11 +183,11 @@ test.serial('Return "true" for valid tag names', async t => {
|
|||||||
t.true(await verifyTagName('tag/name'));
|
t.true(await verifyTagName('tag/name'));
|
||||||
});
|
});
|
||||||
|
|
||||||
test.serial('Return "false" for invalid tag names', async t => {
|
test.serial('Return falsy for invalid tag names', async t => {
|
||||||
t.false(await verifyTagName('?1.0.0'));
|
t.falsy(await verifyTagName('?1.0.0'));
|
||||||
t.false(await verifyTagName('*1.0.0'));
|
t.falsy(await verifyTagName('*1.0.0'));
|
||||||
t.false(await verifyTagName('[1.0.0]'));
|
t.falsy(await verifyTagName('[1.0.0]'));
|
||||||
t.false(await verifyTagName('1.0.0..'));
|
t.falsy(await verifyTagName('1.0.0..'));
|
||||||
});
|
});
|
||||||
|
|
||||||
test.serial('Throws error if obtaining the tags fails', async t => {
|
test.serial('Throws error if obtaining the tags fails', async t => {
|
||||||
|
|||||||
Reference in New Issue
Block a user