test: convert from tape to tap
This commit is contained in:
parent
649af78c56
commit
4e90e4b98b
@ -31,8 +31,7 @@
|
|||||||
"nock": "^2.2.0",
|
"nock": "^2.2.0",
|
||||||
"sinopia": "^1.0.0",
|
"sinopia": "^1.0.0",
|
||||||
"standard": "^4.0.1",
|
"standard": "^4.0.1",
|
||||||
"tap-spec": "^4.0.0",
|
"tap": "^1.2.0"
|
||||||
"tape": "^4.0.0"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"iojs": "^1",
|
"iojs": "^1",
|
||||||
@ -69,7 +68,7 @@
|
|||||||
"prepublish": "npm run build && ./bin/semantic-release.js pre",
|
"prepublish": "npm run build && ./bin/semantic-release.js pre",
|
||||||
"pretest": "npm run build",
|
"pretest": "npm run build",
|
||||||
"test": "./bin/test",
|
"test": "./bin/test",
|
||||||
"test:integration": "node tests | tap-spec",
|
"test:integration": "tap tests/{scenarios,tap}/*.js",
|
||||||
"test:style": "standard"
|
"test:style": "standard"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
'use strict'
|
|
||||||
|
|
||||||
require('./tap/npm-info')()
|
|
||||||
require('./scenarios/custom-analyzer')()
|
|
||||||
require('./scenarios/custom-verification')()
|
|
||||||
require('./scenarios/ignore')()
|
|
||||||
require('./scenarios/prepublish')()
|
|
||||||
require('./scenarios/postpublish')()
|
|
||||||
require('./scenarios/publish')()
|
|
||||||
require('./scenarios/verify')()
|
|
||||||
require('./scenarios/setup')()
|
|
@ -3,23 +3,21 @@
|
|||||||
var path = require('path')
|
var path = require('path')
|
||||||
|
|
||||||
var efh = require('error-first-handler')
|
var efh = require('error-first-handler')
|
||||||
var test = require('tape')
|
var test = require('tap').test
|
||||||
|
|
||||||
var createModule = require('../lib/create-module')
|
var createModule = require('../lib/create-module')
|
||||||
var commitToVersionTest = require('../lib/commit-to-version-test')
|
var commitToVersionTest = require('../lib/commit-to-version-test')
|
||||||
|
|
||||||
module.exports = function () {
|
test('custom-analyzer', function (t) {
|
||||||
createModule({
|
createModule({
|
||||||
release: {
|
release: {
|
||||||
analyzer: path.join(__dirname, '../lib/custom-analyzer')
|
analyzer: path.join(__dirname, '../lib/custom-analyzer')
|
||||||
}
|
}
|
||||||
}, efh()(function (name, cwd) {
|
}, efh()(function (name, cwd) {
|
||||||
test('custom-analyzer', function (t) {
|
commitToVersionTest(t, 'HO', '0.0.0', 1, 'abort publish w/o changes', cwd)
|
||||||
commitToVersionTest(t, 'HO', '0.0.0', 1, 'abort publish w/o changes', cwd)
|
commitToVersionTest(t, 'BAZ', '1.0.0', 0, 'release 1.0.0 if unpublished', cwd)
|
||||||
commitToVersionTest(t, 'BAZ', '1.0.0', 0, 'release 1.0.0 if unpublished', cwd)
|
commitToVersionTest(t, 'BAZ', '1.0.1', 0, 'bump patch for fix', cwd)
|
||||||
commitToVersionTest(t, 'BAZ', '1.0.1', 0, 'bump patch for fix', cwd)
|
commitToVersionTest(t, 'BAR', '1.1.0', 0, 'bump minor for feature', cwd)
|
||||||
commitToVersionTest(t, 'BAR', '1.1.0', 0, 'bump minor for feature', cwd)
|
commitToVersionTest(t, 'FOO', '2.0.0', 0, 'bump major for breaking change', cwd)
|
||||||
commitToVersionTest(t, 'FOO', '2.0.0', 0, 'bump major for breaking change', cwd)
|
|
||||||
})
|
|
||||||
}))
|
}))
|
||||||
}
|
})
|
||||||
|
@ -4,45 +4,43 @@ var path = require('path')
|
|||||||
|
|
||||||
var efh = require('error-first-handler')
|
var efh = require('error-first-handler')
|
||||||
var nixt = require('nixt')
|
var nixt = require('nixt')
|
||||||
var test = require('tape')
|
var test = require('tap').test
|
||||||
|
|
||||||
var createModule = require('../lib/create-module')
|
var createModule = require('../lib/create-module')
|
||||||
|
|
||||||
module.exports = function () {
|
test('custom-verification', function (t) {
|
||||||
createModule({
|
createModule({
|
||||||
release: {
|
release: {
|
||||||
verification: path.join(__dirname, '../lib/custom-verification')
|
verification: path.join(__dirname, '../lib/custom-verification')
|
||||||
}
|
}
|
||||||
}, efh()(function (name, cwd) {
|
}, efh()(function (name, cwd) {
|
||||||
test('custom-verification', function (t) {
|
t.test('even commit count', function (t) {
|
||||||
t.test('even commit count', function (t) {
|
t.plan(1)
|
||||||
t.plan(1)
|
nixt()
|
||||||
nixt()
|
.cwd(cwd)
|
||||||
.cwd(cwd)
|
.env('CI', true)
|
||||||
.env('CI', true)
|
.env('npm_config_registry', 'http://127.0.0.1:4873/')
|
||||||
.env('npm_config_registry', 'http://127.0.0.1:4873/')
|
.exec('git commit --allow-empty -m "feat: commit"')
|
||||||
.exec('git commit --allow-empty -m "feat: commit"')
|
.run('npm run prepublish')
|
||||||
.run('npm run prepublish')
|
.code(0)
|
||||||
.code(0)
|
.end(function (err) {
|
||||||
.end(function (err) {
|
t.error(err, 'nixt')
|
||||||
t.error(err, 'nixt')
|
})
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
|
||||||
t.test('odd commit count', function (t) {
|
t.test('odd commit count', function (t) {
|
||||||
t.plan(1)
|
t.plan(1)
|
||||||
nixt()
|
nixt()
|
||||||
.cwd(cwd)
|
.cwd(cwd)
|
||||||
.env('CI', true)
|
.env('CI', true)
|
||||||
.env('npm_config_registry', 'http://127.0.0.1:4873/')
|
.env('npm_config_registry', 'http://127.0.0.1:4873/')
|
||||||
.exec('git commit --allow-empty -m "feat: commit"')
|
.exec('git commit --allow-empty -m "feat: commit"')
|
||||||
.run('npm run prepublish')
|
.run('npm run prepublish')
|
||||||
.code(1)
|
.code(1)
|
||||||
.stdout(/Verification failed/)
|
.stdout(/Verification failed/)
|
||||||
.end(function (err) {
|
.end(function (err) {
|
||||||
t.error(err, 'nixt')
|
t.error(err, 'nixt')
|
||||||
})
|
})
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}))
|
}))
|
||||||
}
|
})
|
||||||
|
@ -4,37 +4,35 @@ var fs = require('fs')
|
|||||||
|
|
||||||
var efh = require('error-first-handler')
|
var efh = require('error-first-handler')
|
||||||
var nixt = require('nixt')
|
var nixt = require('nixt')
|
||||||
var test = require('tape')
|
var test = require('tap').test
|
||||||
|
|
||||||
var createModule = require('../lib/create-module')
|
var createModule = require('../lib/create-module')
|
||||||
|
|
||||||
module.exports = function () {
|
test('ignore', function (t) {
|
||||||
createModule(efh()(function (name, cwd) {
|
createModule(efh()(function (name, cwd) {
|
||||||
test('ignore', function (t) {
|
ignoreTest(t, cwd, 'npm install', 'not doing anything when the module is installed')
|
||||||
ignoreTest(t, 'npm install', 'not doing anything when the module is installed')
|
ignoreTest(t, cwd, 'npm i', 'not doing anything when the module is installed with abbrevd command')
|
||||||
ignoreTest(t, 'npm i', 'not doing anything when the module is installed with abbrevd command')
|
ignoreTest(t, cwd, 'npm link', 'not doing anything when the module is linked')
|
||||||
ignoreTest(t, 'npm link', 'not doing anything when the module is linked')
|
ignoreTest(t, cwd, 'npm lin', 'not doing anything when the module is linked with abbrevd command')
|
||||||
ignoreTest(t, 'npm lin', 'not doing anything when the module is linked with abbrevd command')
|
ignoreTest(t, cwd, 'npm pack', 'not doing anything when the module is packed')
|
||||||
ignoreTest(t, 'npm pack', 'not doing anything when the module is packed')
|
ignoreTest(t, cwd, 'npm pa', 'not doing anything when the module is packed with abbrevd command')
|
||||||
ignoreTest(t, 'npm pa', 'not doing anything when the module is packed with abbrevd command')
|
|
||||||
})
|
|
||||||
|
|
||||||
function ignoreTest (t, command, name, last) {
|
|
||||||
t.test(name, function (t) {
|
|
||||||
t.plan(2)
|
|
||||||
|
|
||||||
var pkg = fs.readFileSync(cwd + '/package.json')
|
|
||||||
|
|
||||||
nixt()
|
|
||||||
.cwd(cwd)
|
|
||||||
.run(command)
|
|
||||||
.code(0)
|
|
||||||
.stdout(/semantic-release.js pre\n$/m)
|
|
||||||
.end(function (err) {
|
|
||||||
t.is(pkg + '', fs.readFileSync(cwd + '/package.json') + '', 'package')
|
|
||||||
t.error(err, 'nixt')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}))
|
}))
|
||||||
|
})
|
||||||
|
|
||||||
|
function ignoreTest (t, cwd, command, name) {
|
||||||
|
t.test(name, function (t) {
|
||||||
|
t.plan(2)
|
||||||
|
|
||||||
|
var pkg = fs.readFileSync(cwd + '/package.json')
|
||||||
|
|
||||||
|
nixt()
|
||||||
|
.cwd(cwd)
|
||||||
|
.run(command)
|
||||||
|
.code(0)
|
||||||
|
.stdout(/semantic-release.js pre\n$/m)
|
||||||
|
.end(function (err) {
|
||||||
|
t.is(pkg + '', fs.readFileSync(cwd + '/package.json') + '', 'package')
|
||||||
|
t.error(err, 'nixt')
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ var path = require('path')
|
|||||||
var efh = require('error-first-handler')
|
var efh = require('error-first-handler')
|
||||||
var GitHubApi = require('github')
|
var GitHubApi = require('github')
|
||||||
var nixt = require('nixt')
|
var nixt = require('nixt')
|
||||||
var test = require('tape')
|
var test = require('tap').test
|
||||||
|
|
||||||
var createModule = require('../lib/create-module')
|
var createModule = require('../lib/create-module')
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ github.authenticate({
|
|||||||
token: '***'
|
token: '***'
|
||||||
})
|
})
|
||||||
|
|
||||||
module.exports = function () {
|
test('postpublish', function (t) {
|
||||||
createModule({
|
createModule({
|
||||||
version: '2.0.0',
|
version: '2.0.0',
|
||||||
repository: {
|
repository: {
|
||||||
@ -29,42 +29,40 @@ module.exports = function () {
|
|||||||
url: 'http://github.com/user/repo'
|
url: 'http://github.com/user/repo'
|
||||||
}
|
}
|
||||||
}, efh()(function (name, cwd) {
|
}, efh()(function (name, cwd) {
|
||||||
test('postpublish', function (t) {
|
var base = getBase(cwd)
|
||||||
var base = getBase(cwd)
|
|
||||||
|
|
||||||
t.test('publish new version to github releases', function (t) {
|
t.test('publish new version to github releases', function (t) {
|
||||||
t.plan(1)
|
t.plan(1)
|
||||||
|
|
||||||
base.clone()
|
base.clone()
|
||||||
.stdout(/semantic-release.js post\n\nGenerating changelog from.*\nParsed/m)
|
.stdout(/semantic-release.js post\n\nGenerating changelog from.*\nParsed/m)
|
||||||
.run('npm run postpublish')
|
.run('npm run postpublish')
|
||||||
.end(function (err) {
|
.end(function (err) {
|
||||||
t.error(err, 'nixt')
|
t.error(err, 'nixt')
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
t.test('publish new version (with detached HEAD) to github releases', function (t) {
|
|
||||||
t.plan(1)
|
|
||||||
|
|
||||||
base.clone()
|
|
||||||
.stdout(/semantic-release.js post\n\nGenerating changelog from.*\nParsed/m)
|
|
||||||
.exec('git checkout `git rev-parse HEAD`')
|
|
||||||
.run('npm run postpublish')
|
|
||||||
.end(function (err) {
|
|
||||||
t.error(err, 'nixt')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
t.test('correct data published', function (t) {
|
|
||||||
t.plan(4)
|
|
||||||
|
|
||||||
github.releases.getRelease({ owner: 'user', repo: 'repo', id: 1}, function (err, raw) {
|
|
||||||
var res = JSON.parse(raw)
|
|
||||||
t.error(err, 'github')
|
|
||||||
t.is(res.tag_name, 'v2.0.0', 'version')
|
|
||||||
t.is(res.author.login, 'user', 'user')
|
|
||||||
t.ok(/\n\n\n#### Features\n\n\* \*\*cool:\*\*\n.*the next big thing/.test(res.body), 'body')
|
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('publish new version (with detached HEAD) to github releases', function (t) {
|
||||||
|
t.plan(1)
|
||||||
|
|
||||||
|
base.clone()
|
||||||
|
.stdout(/semantic-release.js post\n\nGenerating changelog from.*\nParsed/m)
|
||||||
|
.exec('git checkout `git rev-parse HEAD`')
|
||||||
|
.run('npm run postpublish')
|
||||||
|
.end(function (err) {
|
||||||
|
t.error(err, 'nixt')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('correct data published', function (t) {
|
||||||
|
t.plan(4)
|
||||||
|
|
||||||
|
github.releases.getRelease({ owner: 'user', repo: 'repo', id: 1}, function (err, raw) {
|
||||||
|
var res = JSON.parse(raw)
|
||||||
|
t.error(err, 'github')
|
||||||
|
t.is(res.tag_name, 'v2.0.0', 'version')
|
||||||
|
t.is(res.author.login, 'user', 'user')
|
||||||
|
t.ok(/\n\n\n#### Features\n\n\* \*\*cool:\*\*\n.*the next big thing/.test(res.body), 'body')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}))
|
}))
|
||||||
@ -79,33 +77,31 @@ module.exports = function () {
|
|||||||
notes: path.join(__dirname, '../lib/custom-release-notes')
|
notes: path.join(__dirname, '../lib/custom-release-notes')
|
||||||
}
|
}
|
||||||
}, efh()(function (name, cwd) {
|
}, efh()(function (name, cwd) {
|
||||||
test('custom-release-notes', function (t) {
|
var base = getBase(cwd)
|
||||||
var base = getBase(cwd)
|
|
||||||
|
|
||||||
t.test('publish new version (with custom notes) to github releases', function (t) {
|
t.test('publish new version (with custom notes) to github releases', function (t) {
|
||||||
t.plan(1)
|
t.plan(1)
|
||||||
|
|
||||||
base.clone()
|
base.clone()
|
||||||
.run('npm run postpublish')
|
.run('npm run postpublish')
|
||||||
.end(function (err) {
|
.end(function (err) {
|
||||||
t.error(err, 'nixt')
|
t.error(err, 'nixt')
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
t.test('custom notes published', function (t) {
|
|
||||||
t.plan(4)
|
|
||||||
|
|
||||||
github.releases.getRelease({ owner: 'user', repo: 'repo', id: 3}, function (err, raw) {
|
|
||||||
var res = JSON.parse(raw)
|
|
||||||
t.error(err, 'github')
|
|
||||||
t.is(res.tag_name, 'v2.0.0', 'version')
|
|
||||||
t.is(res.author.login, 'user', 'user')
|
|
||||||
t.ok(/custom log/.test(res.body), 'body')
|
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('custom notes published', function (t) {
|
||||||
|
t.plan(4)
|
||||||
|
|
||||||
|
github.releases.getRelease({ owner: 'user', repo: 'repo', id: 3}, function (err, raw) {
|
||||||
|
var res = JSON.parse(raw)
|
||||||
|
t.error(err, 'github')
|
||||||
|
t.is(res.tag_name, 'v2.0.0', 'version')
|
||||||
|
t.is(res.author.login, 'user', 'user')
|
||||||
|
t.ok(/custom log/.test(res.body), 'body')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}))
|
}))
|
||||||
}
|
})
|
||||||
|
|
||||||
function getBase (cwd) {
|
function getBase (cwd) {
|
||||||
return nixt()
|
return nixt()
|
||||||
|
@ -1,19 +1,17 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
var efh = require('error-first-handler')
|
var efh = require('error-first-handler')
|
||||||
var test = require('tape')
|
var test = require('tap').test
|
||||||
|
|
||||||
var createModule = require('../lib/create-module')
|
var createModule = require('../lib/create-module')
|
||||||
var commitToVersionTest = require('../lib/commit-to-version-test')
|
var commitToVersionTest = require('../lib/commit-to-version-test')
|
||||||
|
|
||||||
module.exports = function () {
|
test('prepublish', function (t) {
|
||||||
createModule(efh()(function (name, cwd) {
|
createModule(efh()(function (name, cwd) {
|
||||||
test('prepublish', function (t) {
|
commitToVersionTest(t, 'refactor: change', '0.0.0', 1, 'abort publish w/o changes', cwd)
|
||||||
commitToVersionTest(t, 'refactor: change', '0.0.0', 1, 'abort publish w/o changes', cwd)
|
commitToVersionTest(t, 'fix: change', '1.0.0', 0, 'release 1.0.0 if unpublished', cwd)
|
||||||
commitToVersionTest(t, 'fix: change', '1.0.0', 0, 'release 1.0.0 if unpublished', cwd)
|
commitToVersionTest(t, 'fix: change', '1.0.1', 0, 'bump patch for fix', cwd)
|
||||||
commitToVersionTest(t, 'fix: change', '1.0.1', 0, 'bump patch for fix', cwd)
|
commitToVersionTest(t, 'feat: change', '1.1.0', 0, 'bump minor for feature', cwd)
|
||||||
commitToVersionTest(t, 'feat: change', '1.1.0', 0, 'bump minor for feature', cwd)
|
commitToVersionTest(t, 'fix: BREAKING CHANGE: change', '2.0.0', 0, 'bump major for breaking change', cwd)
|
||||||
commitToVersionTest(t, 'fix: BREAKING CHANGE: change', '2.0.0', 0, 'bump major for breaking change', cwd)
|
|
||||||
})
|
|
||||||
}))
|
}))
|
||||||
}
|
})
|
||||||
|
@ -2,39 +2,37 @@
|
|||||||
|
|
||||||
var efh = require('error-first-handler')
|
var efh = require('error-first-handler')
|
||||||
var nixt = require('nixt')
|
var nixt = require('nixt')
|
||||||
var test = require('tape')
|
var test = require('tap').test
|
||||||
|
|
||||||
var createModule = require('../lib/create-module')
|
var createModule = require('../lib/create-module')
|
||||||
|
|
||||||
module.exports = function () {
|
test('publish', function (t) {
|
||||||
test('publish', function (t) {
|
publishTest(t, 'npm publish', 'pre and post hooks work as a part of publish')
|
||||||
publishTest(t, 'npm publish', 'pre and post hooks work as a part of publish')
|
publishTest(t, 'npm pub', 'pre and post hooks work as a part of publish with abbrevd command')
|
||||||
publishTest(t, 'npm pub', 'pre and post hooks work as a part of publish with abbrevd command')
|
|
||||||
|
|
||||||
function publishTest (t, command, testname, last) {
|
function publishTest (t, command, testname, last) {
|
||||||
createModule({
|
createModule({
|
||||||
repository: {
|
repository: {
|
||||||
type: 'git',
|
type: 'git',
|
||||||
url: 'http://github.com/user/repo'
|
url: 'http://github.com/user/repo'
|
||||||
}
|
}
|
||||||
}, efh()(function (name, cwd) {
|
}, efh()(function (name, cwd) {
|
||||||
t.test(testname, function (t) {
|
t.test(testname, function (t) {
|
||||||
t.plan(1)
|
t.plan(1)
|
||||||
|
|
||||||
nixt()
|
nixt()
|
||||||
.cwd(cwd)
|
.cwd(cwd)
|
||||||
.env('CI', true)
|
.env('CI', true)
|
||||||
.env('GH_URL', 'http://127.0.0.1:4343/')
|
.env('GH_URL', 'http://127.0.0.1:4343/')
|
||||||
.env('GH_TOKEN', '***')
|
.env('GH_TOKEN', '***')
|
||||||
.exec('git commit --allow-empty -m "feat: super"')
|
.exec('git commit --allow-empty -m "feat: super"')
|
||||||
.run(command)
|
.run(command)
|
||||||
.code(1)
|
.code(1)
|
||||||
.stdout(/Everything is alright/)
|
.stdout(/Everything is alright/)
|
||||||
.end(function (err) {
|
.end(function (err) {
|
||||||
t.error(err, 'nixt')
|
t.error(err, 'nixt')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
@ -5,37 +5,35 @@ var readFile = require('fs').readFileSync
|
|||||||
|
|
||||||
var efh = require('error-first-handler')
|
var efh = require('error-first-handler')
|
||||||
var nixt = require('nixt')
|
var nixt = require('nixt')
|
||||||
var test = require('tape')
|
var test = require('tap').test
|
||||||
|
|
||||||
var createModule = require('../lib/create-module')
|
var createModule = require('../lib/create-module')
|
||||||
|
|
||||||
module.exports = function () {
|
test('setup', function (t) {
|
||||||
createModule({
|
createModule({
|
||||||
repository: {},
|
repository: {},
|
||||||
scripts: {
|
scripts: {
|
||||||
postpublish: 'npm run gh-pages'
|
postpublish: 'npm run gh-pages'
|
||||||
}
|
}
|
||||||
}, efh()(function (name, cwd) {
|
}, efh()(function (name, cwd) {
|
||||||
test('setup', function (t) {
|
t.test('setup "package.json"', function (t) {
|
||||||
t.test('setup "package.json"', function (t) {
|
t.plan(5)
|
||||||
t.plan(5)
|
|
||||||
|
|
||||||
nixt()
|
nixt()
|
||||||
.cwd(cwd)
|
.cwd(cwd)
|
||||||
.exec('git remote add origin git@github.com:user/repo.git')
|
.exec('git remote add origin git@github.com:user/repo.git')
|
||||||
.run('../../../bin/semantic-release.js setup')
|
.run('../../../bin/semantic-release.js setup')
|
||||||
.code(0)
|
.code(0)
|
||||||
.end(function (err) {
|
.end(function (err) {
|
||||||
t.error(err, 'nixt')
|
t.error(err, 'nixt')
|
||||||
|
|
||||||
var pkg = JSON.parse(readFile(join(cwd, 'package.json')))
|
var pkg = JSON.parse(readFile(join(cwd, 'package.json')))
|
||||||
|
|
||||||
t.is(pkg.version, '0.0.0-semantically-released', 'version')
|
t.is(pkg.version, '0.0.0-semantically-released', 'version')
|
||||||
t.is(pkg.repository.url, 'https://github.com/user/repo', 'repo')
|
t.is(pkg.repository.url, 'https://github.com/user/repo', 'repo')
|
||||||
t.is(pkg.scripts.prepublish, 'semantic-release pre', 'pre')
|
t.is(pkg.scripts.prepublish, 'semantic-release pre', 'pre')
|
||||||
t.is(pkg.scripts.postpublish, 'npm run gh-pages && semantic-release post', 'post')
|
t.is(pkg.scripts.postpublish, 'npm run gh-pages && semantic-release post', 'post')
|
||||||
})
|
})
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}))
|
}))
|
||||||
}
|
})
|
||||||
|
@ -2,52 +2,50 @@
|
|||||||
|
|
||||||
var efh = require('error-first-handler')
|
var efh = require('error-first-handler')
|
||||||
var nixt = require('nixt')
|
var nixt = require('nixt')
|
||||||
var test = require('tape')
|
var test = require('tap').test
|
||||||
|
|
||||||
var createModule = require('../lib/create-module')
|
var createModule = require('../lib/create-module')
|
||||||
|
|
||||||
module.exports = function () {
|
test('verify', function (t) {
|
||||||
test('verify', function (t) {
|
createModule({
|
||||||
createModule({
|
repository: {},
|
||||||
repository: {},
|
scripts: {
|
||||||
scripts: {
|
prepublish: '../../../bin/semantic-release.js pre --no-token'
|
||||||
prepublish: '../../../bin/semantic-release.js pre'
|
}
|
||||||
}
|
}, efh()(function (name, cwd) {
|
||||||
}, efh()(function (name, cwd) {
|
t.test('verify package and options before publishing', function (t) {
|
||||||
t.test('verify package and options before publishing', function (t) {
|
t.plan(1)
|
||||||
t.plan(1)
|
nixt()
|
||||||
nixt()
|
.cwd(cwd)
|
||||||
.cwd(cwd)
|
.env('CI', true)
|
||||||
.env('CI', true)
|
.run('npm publish')
|
||||||
.run('npm publish')
|
.stderr(new RegExp(
|
||||||
.stderr(new RegExp(
|
'You must define a GitHub token\.\n' +
|
||||||
'You must define a GitHub token\.\n' +
|
'You must define your GitHub "repository" inside the "package.json"\.\n' +
|
||||||
'You must define your GitHub "repository" inside the "package.json"\.\n' +
|
'You must define your "scripts" inside the "package.json"\.'
|
||||||
'You must define your "scripts" inside the "package.json"\.'
|
, 'm'
|
||||||
, 'm'
|
))
|
||||||
))
|
.code(1)
|
||||||
.code(1)
|
.end(function (err) {
|
||||||
.end(function (err) {
|
t.error(err, 'nixt')
|
||||||
t.error(err, 'nixt')
|
})
|
||||||
})
|
})
|
||||||
})
|
}))
|
||||||
}))
|
|
||||||
|
|
||||||
createModule({
|
createModule({
|
||||||
version: '1.0.0-semantically-released'
|
version: '1.0.0-semantically-released'
|
||||||
}, efh()(function (name, cwd) {
|
}, efh()(function (name, cwd) {
|
||||||
t.test('not publishing placeholder versions', function (t) {
|
t.test('not publishing placeholder versions', function (t) {
|
||||||
t.plan(1)
|
t.plan(1)
|
||||||
|
|
||||||
nixt()
|
nixt()
|
||||||
.cwd(cwd)
|
.cwd(cwd)
|
||||||
.env('CI', true)
|
.env('CI', true)
|
||||||
.run('npm publish --semantic-release-rerun')
|
.run('npm publish --semantic-release-rerun')
|
||||||
.code(1)
|
.code(1)
|
||||||
.end(function (err) {
|
.end(function (err) {
|
||||||
t.error(err, 'nixt')
|
t.error(err, 'nixt')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
var test = require('tape')
|
var test = require('tap').test
|
||||||
var nock = require('nock')
|
var nock = require('nock')
|
||||||
|
|
||||||
var npmInfo = require('../../dist/lib/npm-info.js')
|
var npmInfo = require('../../dist/lib/npm-info.js')
|
||||||
@ -20,34 +20,32 @@ var defaultModule = {
|
|||||||
|
|
||||||
process.env.npm_config_registry = registry
|
process.env.npm_config_registry = registry
|
||||||
|
|
||||||
module.exports = function () {
|
test('npm-info', function (t) {
|
||||||
test('npm-info', function (t) {
|
var regMock = nock(registry, {
|
||||||
var regMock = nock(registry, {
|
reqheaders: {
|
||||||
reqheaders: {
|
'authorization': 'Bearer testtoken'
|
||||||
'authorization': 'Bearer testtoken'
|
}
|
||||||
}
|
})
|
||||||
})
|
.get('/express')
|
||||||
.get('/express')
|
.reply(200, defaultModule)
|
||||||
.reply(200, defaultModule)
|
.get('/@user%2Fmodule')
|
||||||
.get('/@user%2Fmodule')
|
.reply(200, defaultModule)
|
||||||
.reply(200, defaultModule)
|
|
||||||
|
|
||||||
t.test('get unscoped module', function (t) {
|
t.test('get unscoped module', function (t) {
|
||||||
t.plan(3)
|
t.plan(3)
|
||||||
npmInfo('express', function (err, info) {
|
npmInfo('express', function (err, info) {
|
||||||
t.error(err, 'error')
|
t.error(err, 'error')
|
||||||
t.is(info.version, '1.0.0', 'version')
|
t.is(info.version, '1.0.0', 'version')
|
||||||
t.is(info.gitHead, 'HEAD', 'gitHead')
|
t.is(info.gitHead, 'HEAD', 'gitHead')
|
||||||
})
|
|
||||||
})
|
|
||||||
t.test('get scoped module', function (t) {
|
|
||||||
t.plan(3)
|
|
||||||
npmInfo('@user/module', function (err, info) {
|
|
||||||
t.error(err, 'error')
|
|
||||||
t.is(info.version, '1.0.0', 'version')
|
|
||||||
t.is(info.gitHead, 'HEAD', 'gitHead')
|
|
||||||
regMock.done()
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
t.test('get scoped module', function (t) {
|
||||||
|
t.plan(3)
|
||||||
|
npmInfo('@user/module', function (err, info) {
|
||||||
|
t.error(err, 'error')
|
||||||
|
t.is(info.version, '1.0.0', 'version')
|
||||||
|
t.is(info.gitHead, 'HEAD', 'gitHead')
|
||||||
|
regMock.done()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user