Skip to content

Commit

Permalink
Fix eslint failures
Browse files Browse the repository at this point in the history
  • Loading branch information
hdgarrood committed Apr 2, 2016
1 parent 3fbca6d commit 49c7fef
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions lib/commands/version.js
Expand Up @@ -29,7 +29,7 @@ function bump(project, versionArg, message) {
}
})
.then(project.getJson.bind(project))
.then(function(/*json (ignored)*/) {
.then(function (/*json (ignored)*/) {
return currentGitVersion(cwd);
})
.then(function (currentVersion) {
Expand Down Expand Up @@ -110,7 +110,7 @@ function gitCommitAndTag(cwd, newVersion, message) {

function currentGitVersion(cwd) {
return Q.nfcall(execFile, 'git', ['tag'], {env: process.env, cwd: cwd})
.then(function(res) {
.then(function (res) {
var versions = res[0]
.split(/\r?\n/)
.map(stripV)
Expand Down
42 changes: 21 additions & 21 deletions test/commands/version.js
Expand Up @@ -16,107 +16,107 @@ describe('bower version', function () {
var packageWithoutTags = new helpers.TempDir({});


it('bumps patch version', function() {
it('bumps patch version', function () {
mainPackage.prepareGit();

return helpers.run(version, ['patch', {}, { cwd: mainPackage.path }]).then(function() {
return helpers.run(version, ['patch', {}, { cwd: mainPackage.path }]).then(function () {
expect(mainPackage.latestGitTag()).to.be('0.0.1');
});
});

it('bumps minor version', function() {
it('bumps minor version', function () {
mainPackage.prepareGit();

return helpers.run(version, ['minor', {}, { cwd: mainPackage.path }]).then(function() {
return helpers.run(version, ['minor', {}, { cwd: mainPackage.path }]).then(function () {
expect(mainPackage.latestGitTag()).to.be('0.1.0');
});
});

it('bumps major version', function() {
it('bumps major version', function () {
mainPackage.prepareGit();

return helpers.run(version, ['major', {}, { cwd: mainPackage.path }]).then(function() {
return helpers.run(version, ['major', {}, { cwd: mainPackage.path }]).then(function () {
expect(mainPackage.latestGitTag()).to.be('1.0.0');
});
});

it('changes version', function() {
it('changes version', function () {
mainPackage.prepareGit();

return helpers.run(version, ['1.2.3', {}, { cwd: mainPackage.path }]).then(function() {
return helpers.run(version, ['1.2.3', {}, { cwd: mainPackage.path }]).then(function () {
expect(mainPackage.latestGitTag()).to.be('1.2.3');
});
});

it('returns the new version', function() {
it('returns the new version', function () {
mainPackage.prepareGit();

return helpers.run(version, ['major', {}, { cwd: mainPackage.path }]).then(function (results) {
expect(results[0]).to.be('1.0.0');
});
});

it('fails on a dirty git repository', function() {
it('fails on a dirty git repository', function () {
mainPackage.prepareGit();
mainPackage.create({
'dirty.txt': 'This file has not been committed'
});

return helpers.run(version, ['patch', {}, { cwd: mainPackage.path }]).then(null, function(err) {
return helpers.run(version, ['patch', {}, { cwd: mainPackage.path }]).then(null, function (err) {
expect(err).to.be.an(Error);
expect(err.code).to.be('ENOTGITREPOSITORY');
});
});

it('fails when the version is not changed', function() {
it('fails when the version is not changed', function () {
mainPackage.prepareGit();

return helpers.run(version, ['0.0.0', {}, { cwd: mainPackage.path }]).then(null, function(err) {
return helpers.run(version, ['0.0.0', {}, { cwd: mainPackage.path }]).then(null, function (err) {
expect(err).to.be.an(Error);
expect(err.code).to.be('EVERSIONNOTCHANGED');
});
});

it('fails with an invalid argument', function() {
it('fails with an invalid argument', function () {
mainPackage.prepareGit();

return helpers.run(version, ['lol', {}, { cwd: mainPackage.path }]).then(null, function(err) {
return helpers.run(version, ['lol', {}, { cwd: mainPackage.path }]).then(null, function (err) {
expect(err).to.be.an(Error);
expect(err.code).to.be('EINVALIDVERSION');
});
});

it('bumps with custom commit message', function() {
it('bumps with custom commit message', function () {
mainPackage.prepareGit();

return helpers.run(version, ['patch', { message: 'Bumping %s, because what'}, { cwd: mainPackage.path }]).then(function() {
return helpers.run(version, ['patch', { message: 'Bumping %s, because what'}, { cwd: mainPackage.path }]).then(function () {
var tags = mainPackage.git('tag');
expect(tags).to.be('v0.0.0\nv0.0.1\n');
var message = mainPackage.git('log', '--pretty=format:%s', '-n1');
expect(message).to.be('Bumping 0.0.1, because what');
});
});

it('creates commit and tags', function() {
it('creates commit and tags', function () {
mainPackage.prepareGit();

return helpers.run(version, ['patch', {}, { cwd: mainPackage.path }]).then(function() {
return helpers.run(version, ['patch', {}, { cwd: mainPackage.path }]).then(function () {
var tags = mainPackage.git('tag');
expect(tags).to.be('v0.0.0\nv0.0.1\n');
var message = mainPackage.git('log', '--pretty=format:%s', '-n1');
expect(message).to.be('v0.0.1');
});
});

it('assumes v0.0.0 when no tags exist', function() {
it('assumes v0.0.0 when no tags exist', function () {
packageWithoutTags.prepareGit();
packageWithoutTags.create({
'index.js': 'console.log("hello, world");'
});
packageWithoutTags.git('add', '-A');
packageWithoutTags.git('commit', '-m"commit"');

return helpers.run(version, ['major', {}, { cwd: packageWithoutTags.path }]).then(function() {
return helpers.run(version, ['major', {}, { cwd: packageWithoutTags.path }]).then(function () {
expect(packageWithoutTags.latestGitTag()).to.be('1.0.0');
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/helpers.js
Expand Up @@ -159,7 +159,7 @@ exports.TempDir = (function () {
TempDir.prototype.latestGitTag = function () {
var versions = this.git('tag')
.split(/\r?\n/)
.map(function(t) { return t.slice(1); })
.map(function (t) { return t.slice(1); })
.filter(semver.valid)
.sort(semver.compare);

Expand Down

0 comments on commit 49c7fef

Please sign in to comment.