style: use es6 in tests
This commit is contained in:
@@ -1,34 +1,32 @@
|
||||
'use strict'
|
||||
const fs = require('fs')
|
||||
const exec = require('child_process').exec
|
||||
|
||||
var fs = require('fs')
|
||||
var exec = require('child_process').exec
|
||||
|
||||
var nixt = require('nixt')
|
||||
const nixt = require('nixt')
|
||||
|
||||
module.exports = function (t, message, version, code, name, cwd) {
|
||||
t.test(name, function (t) {
|
||||
t.test(name, (t) => {
|
||||
t.plan(3)
|
||||
|
||||
nixt()
|
||||
.cwd(cwd)
|
||||
.env('CI', true)
|
||||
.env('npm_config_registry', 'http://127.0.0.1:4873/')
|
||||
.exec('git commit --allow-empty -m "' + message + '"')
|
||||
.exec(`git commit --allow-empty -m "${message}"`)
|
||||
.run('npm run prepublish')
|
||||
.code(code)
|
||||
.stdout(/semantic-release.js pre\n\nDetermining new version\n/m)
|
||||
.end(function (err) {
|
||||
.end((err) => {
|
||||
t.error(err, 'nixt')
|
||||
|
||||
var pkg = JSON.parse(fs.readFileSync(cwd + '/package.json'))
|
||||
const pkg = JSON.parse(fs.readFileSync(`${cwd}/package.json`))
|
||||
t.is(pkg.version, version, 'version')
|
||||
|
||||
if (code === 1) {
|
||||
return t.error(null, 'no publish')
|
||||
}
|
||||
|
||||
exec('npm publish --ignore-scripts', {cwd: cwd}, function (err) {
|
||||
setTimeout(function () {
|
||||
exec('npm publish --ignore-scripts', {cwd}, (err) => {
|
||||
setTimeout(() => {
|
||||
t.error(err, 'publish')
|
||||
}, 300)
|
||||
})
|
||||
|
||||
+18
-20
@@ -1,16 +1,14 @@
|
||||
'use strict'
|
||||
const exec = require('child_process').exec
|
||||
const join = require('path').join
|
||||
|
||||
var exec = require('child_process').exec
|
||||
var join = require('path').join
|
||||
|
||||
var efh = require('error-first-handler')
|
||||
var defaults = require('lodash.defaults')
|
||||
var uid = require('nano-uid')()
|
||||
const efh = require('error-first-handler')
|
||||
const defaults = require('lodash.defaults')
|
||||
const uid = require('nano-uid')()
|
||||
|
||||
module.exports = function (input) {
|
||||
var cb = Array.prototype.pop.call(arguments)
|
||||
uid.generate(5, efh(cb)(function (id) {
|
||||
var pkg = defaults((typeof input === 'object' ? input : {}), {
|
||||
const cb = Array.prototype.pop.call(arguments)
|
||||
uid.generate(5, efh(cb)((id) => {
|
||||
const pkg = defaults((typeof input === 'object' ? input : {}), {
|
||||
name: id,
|
||||
version: '0.0.0',
|
||||
scripts: {
|
||||
@@ -23,18 +21,18 @@ module.exports = function (input) {
|
||||
})
|
||||
|
||||
id = pkg.name
|
||||
var cwd = join(__dirname, '../../.tmp/modules', id)
|
||||
const cwd = join(__dirname, '../../.tmp/modules', id)
|
||||
|
||||
exec(
|
||||
'mkdir ' + cwd + ' && ' +
|
||||
'cd ' + cwd + ' && ' +
|
||||
'git init && ' +
|
||||
'echo \'' + JSON.stringify(pkg, null, 2) + '\' >> package.json && ' +
|
||||
'git add . && ' +
|
||||
'git config user.email "integration@test" && ' +
|
||||
'git config user.name "Integration Test" && ' +
|
||||
'git commit -m "initial"'
|
||||
, efh(cb)(function (stdout) {
|
||||
`mkdir ${cwd} &&
|
||||
cd ${cwd} &&
|
||||
git init &&
|
||||
echo '${JSON.stringify(pkg, null, 2)}' >> package.json &&
|
||||
git add . &&
|
||||
git config user.email "integration@test" &&
|
||||
git config user.name "Integration Test" &&
|
||||
git commit -m "initial"`
|
||||
, efh(cb)((stdout) => {
|
||||
cb(null, id, cwd)
|
||||
}))
|
||||
}))
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = function (commits) {
|
||||
var type = null
|
||||
let type = null
|
||||
|
||||
commits.every(function (commit) {
|
||||
commits.every((commit) => {
|
||||
if (/FOO/.test(commit.message)) {
|
||||
type = 'major'
|
||||
return false
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = function (cb) {
|
||||
cb(null, 'custom log')
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = function (opts, cb) {
|
||||
cb(null, !(opts.commits.length % 2))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user