Skip to content

Commit

Permalink
test: don't pollute user's config
Browse files Browse the repository at this point in the history
I really don't like it when all my tags start being prefixed with q.

Also reformatted test.
  • Loading branch information
othiym23 authored and iarna committed Aug 21, 2015
1 parent 1fa9169 commit 67c1329
Showing 1 changed file with 43 additions and 40 deletions.
83 changes: 43 additions & 40 deletions test/tap/tag-version-prefix.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,46 +25,49 @@ test('npm version <semver> with message config', function (t) {
var git = require('../../lib/utils/git.js')

common.makeGitRepo({ path: pkg }, function (er) {
t.ifErr(er, 'git bootstrap ran without error')

common.npm(
[
'config',
'set',
'tag-version-prefix',
'q'
],
{ cwd: pkg, env: { PATH: process.env.PATH } },
function (err, code, stdout, stderr) {
t.ifError(err, 'npm config ran without issue')
t.notOk(code, 'exited with a non-error code')
t.notOk(stderr, 'no error output')

common.npm(
[
'version',
'patch',
'--loglevel', 'silent'
// package config is picked up from env
],
{ cwd: pkg, env: { PATH: process.env.PATH } },
function (err, code, stdout, stderr) {
t.ifError(err, 'npm version ran without issue')
t.notOk(code, 'exited with a non-error code')
t.notOk(stderr, 'no error output')

git.whichAndExec(
['tag'],
{ cwd: pkg, env: process.env },
function (er, tags, stderr) {
t.ok(tags.match(/q0\.1\.3/g), 'tag was created by version' + tags)
t.end()
}
)
}
)
})
})
t.ifErr(er, 'git bootstrap ran without error')

common.npm(
[
'--userconfig', npmrc,
'config',
'set',
'tag-version-prefix',
'q'
],
{ cwd: pkg, env: { PATH: process.env.PATH } },
function (err, code, stdout, stderr) {
t.ifError(err, 'npm config ran without issue')
t.notOk(code, 'exited with a non-error code')
t.notOk(stderr, 'no error output')

common.npm(
[
'version',
'patch',
'--loglevel', 'silent'
// package config is picked up from env
],
{ cwd: pkg, env: { PATH: process.env.PATH } },
function (err, code, stdout, stderr) {
t.ifError(err, 'npm version ran without issue')
t.notOk(code, 'exited with a non-error code')
t.notOk(stderr, 'no error output')

git.whichAndExec(
['tag'],
{ cwd: pkg, env: process.env },
function (er, tags, stderr) {
t.ok(tags.match(/q0\.1\.3/g), 'tag was created by version' + tags)
t.end()
}
)
}
)
}
)
}
)
})
})

Expand Down

0 comments on commit 67c1329

Please sign in to comment.